@@ -11,6 +11,7 @@ import (
11
11
"path/filepath"
12
12
"runtime/debug"
13
13
"strconv"
14
+ "strings"
14
15
"text/template"
15
16
"time"
16
17
@@ -188,14 +189,20 @@ func main() {
188
189
189
190
socketHandler := wsHandler ().ServeHTTP
190
191
191
- extraOriginStr := "https://create.arduino.cc, http://create.arduino.cc, https://create-dev.arduino.cc, http://create-dev.arduino.cc, https://create-intel.arduino.cc, http://create-intel.arduino.cc"
192
+ extraOrigins := []string {
193
+ "https://create.arduino.cc" ,
194
+ "http://create.arduino.cc" , "https://create-dev.arduino.cc" , "http://create-dev.arduino.cc" , "https://create-intel.arduino.cc" , "http://create-intel.arduino.cc" ,
195
+ }
192
196
193
197
for i := 8990 ; i < 9001 ; i ++ {
194
- extraOriginStr = extraOriginStr + ", http://localhost:" + strconv .Itoa (i ) + ", https://localhost:" + strconv .Itoa (i )
198
+ port := strconv .Itoa (i )
199
+ extraOrigins = append (extraOrigins , "http://localhost:" + port )
200
+ extraOrigins = append (extraOrigins , "https://localhost:" + port )
201
+ extraOrigins = append (extraOrigins , "http://127.0.0.1:" + port )
195
202
}
196
203
197
204
r .Use (cors .Middleware (cors.Config {
198
- Origins : * origins + ", " + extraOriginStr ,
205
+ Origins : * origins + ", " + strings . Join ( extraOrigins , ", " ) ,
199
206
Methods : "GET, PUT, POST, DELETE" ,
200
207
RequestHeaders : "Origin, Authorization, Content-Type" ,
201
208
ExposedHeaders : "" ,
0 commit comments