this repo has no description smallweb.run
smallweb
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix auth code, add sample setup

pomdtr 68809e89 2a31bd72

+32 -14
-1
.gitignore
··· 5 5 6 6 __debug_bin* 7 7 .envrc 8 - .smallweb
+8 -2
.vscode/launch.json
··· 7 7 "program": "${workspaceFolder}/main.go", 8 8 "args": [ 9 9 "up", 10 - ] 10 + ], 11 + "env": { 12 + "SMALLWEB_DIR": "${workspaceFolder}/examples" 13 + }, 11 14 }, 12 15 { 13 16 "name": "smallweb cli", 14 17 "type": "go", 15 18 "request": "launch", 16 19 "program": "${workspaceFolder}/main.go", 20 + "args": [], 21 + "env": { 22 + "SMALLWEB_DIR": "${workspaceFolder}/examples" 23 + }, 17 24 "console": "integratedTerminal", 18 - "args": [] 19 25 } 20 26 ] 21 27 }
+2 -4
api/schemas/config.schema.json
··· 19 19 "type": "string" 20 20 }, 21 21 "auth": { 22 - "description": "Authentication method", 22 + "description": "Authentication method. Leave empty to choose at runtime.", 23 23 "enum": [ 24 - "lastlogin", 25 - "email", 24 + "github", 26 25 "google", 27 - "github", 28 26 "gitlab", 29 27 "facebook" 30 28 ]
+7 -7
auth/auth.go
··· 283 283 } 284 284 285 285 session, err := GetSession(cookie.Value) 286 - if session.Domain != r.Host || session.Email != email { 286 + if err != nil { 287 287 http.SetCookie(w, &http.Cookie{ 288 288 Name: sessionCookieName, 289 289 Expires: time.Now().Add(-1 * time.Hour), ··· 291 291 HttpOnly: true, 292 292 Secure: true, 293 293 }) 294 - 295 - if err := DeleteSession(cookie.Value); err != nil { 296 - http.Error(w, "Internal Server Error", http.StatusInternalServerError) 297 - return 298 - } 299 294 300 295 http.Redirect(w, r, fmt.Sprintf("/_auth/login?redirect=%s", r.URL.Path), http.StatusSeeOther) 301 296 return 302 297 } 303 298 304 - if err != nil { 299 + if session.Domain != r.Host { 305 300 http.SetCookie(w, &http.Cookie{ 306 301 Name: sessionCookieName, 307 302 Expires: time.Now().Add(-1 * time.Hour), ··· 309 304 HttpOnly: true, 310 305 Secure: true, 311 306 }) 307 + 308 + if err := DeleteSession(cookie.Value); err != nil { 309 + http.Error(w, "Internal Server Error", http.StatusInternalServerError) 310 + return 311 + } 312 312 313 313 http.Redirect(w, r, fmt.Sprintf("/_auth/login?redirect=%s", r.URL.Path), http.StatusSeeOther) 314 314 return
+2
examples/.gitignore
··· 1 + .smallweb/data 2 + .env
+4
examples/.smallweb/config.json
··· 1 + { 2 + "domain": "localhost", 3 + "email": "pomdtr@example.com" 4 + }
+9
examples/demo/main.ts
··· 1 + export default { 2 + fetch: () => { 3 + return new Response('Hello, World!', { 4 + headers: { 5 + 'content-type': 'text/plain' 6 + } 7 + }); 8 + } 9 + }