acebase-server 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +49 -0
- package/README.md +10 -0
- package/dist/cjs/auth.js +2 -2
- package/dist/cjs/cluster.js +2 -2
- package/dist/cjs/middleware/cors.js +3 -3
- package/dist/cjs/oauth-providers/dropbox.js +22 -22
- package/dist/cjs/oauth-providers/facebook.js +16 -16
- package/dist/cjs/oauth-providers/google.js +33 -39
- package/dist/cjs/oauth-providers/index.js +1 -1
- package/dist/cjs/oauth-providers/instagram.js +12 -12
- package/dist/cjs/oauth-providers/oauth-provider.js +0 -5
- package/dist/cjs/oauth-providers/spotify.js +34 -34
- package/dist/cjs/routes/auth-change-password.js +5 -5
- package/dist/cjs/routes/auth-delete.js +1 -1
- package/dist/cjs/routes/auth-forgot-password.js +2 -2
- package/dist/cjs/routes/auth-reset-password.js +11 -9
- package/dist/cjs/routes/auth-signin.js +1 -1
- package/dist/cjs/routes/auth-signout.js +1 -1
- package/dist/cjs/routes/auth-signup.js +5 -5
- package/dist/cjs/routes/auth-update.js +1 -1
- package/dist/cjs/routes/auth-verify-email.js +8 -6
- package/dist/cjs/routes/auth.js +1 -1
- package/dist/cjs/routes/data-export.js +1 -1
- package/dist/cjs/routes/data-get.js +2 -2
- package/dist/cjs/routes/data-index-list.js +0 -1
- package/dist/cjs/routes/data-query.js +1 -1
- package/dist/cjs/routes/data-reflect.js +4 -4
- package/dist/cjs/routes/data-schema-get.js +1 -1
- package/dist/cjs/routes/data-schemas-list.js +1 -1
- package/dist/cjs/routes/data-transaction.js +1 -1
- package/dist/cjs/routes/docs.js +57 -54
- package/dist/cjs/routes/meta-info.js +8 -12
- package/dist/cjs/routes/meta-logs.js +1 -1
- package/dist/cjs/routes/oauth2-init.js +8 -5
- package/dist/cjs/routes/oauth2-refresh.js +2 -2
- package/dist/cjs/routes/oauth2-signin.js +23 -23
- package/dist/cjs/routes/webmanager.js +4 -4
- package/dist/cjs/rules.js +8 -8
- package/dist/cjs/schema/user.js +1 -2
- package/dist/cjs/server.js +74 -31
- package/dist/cjs/settings/email.js +0 -2
- package/dist/cjs/settings/index.js +19 -4
- package/dist/cjs/shared/email.js +0 -4
- package/dist/cjs/shared/env.js +0 -2
- package/dist/cjs/shared/error.js +0 -1
- package/dist/cjs/shared/http.js +9 -1
- package/dist/cjs/shared/password.js +5 -5
- package/dist/cjs/shared/rootpath.js +1 -1
- package/dist/cjs/shared/signin.js +3 -3
- package/dist/cjs/shared/simple-fetch.js +5 -5
- package/dist/cjs/shared/tokens.js +3 -3
- package/dist/cjs/start.js +6 -6
- package/dist/cjs/websocket/index.js +11 -11
- package/dist/cjs/websocket/socket.io.js +2 -1
- package/dist/esm/auth.js +5 -5
- package/dist/esm/cluster.js +2 -2
- package/dist/esm/middleware/admin-only.js +1 -1
- package/dist/esm/middleware/cors.js +3 -3
- package/dist/esm/middleware/user.js +3 -3
- package/dist/esm/oauth-providers/dropbox.js +47 -51
- package/dist/esm/oauth-providers/facebook.js +34 -38
- package/dist/esm/oauth-providers/google.js +33 -39
- package/dist/esm/oauth-providers/index.js +1 -1
- package/dist/esm/oauth-providers/instagram.js +28 -32
- package/dist/esm/oauth-providers/oauth-provider.js +0 -5
- package/dist/esm/oauth-providers/spotify.js +46 -52
- package/dist/esm/routes/auth-change-password.js +5 -5
- package/dist/esm/routes/auth-delete.js +1 -1
- package/dist/esm/routes/auth-forgot-password.js +2 -2
- package/dist/esm/routes/auth-reset-password.js +11 -9
- package/dist/esm/routes/auth-signin.js +1 -1
- package/dist/esm/routes/auth-signout.js +1 -1
- package/dist/esm/routes/auth-signup.js +5 -5
- package/dist/esm/routes/auth-update.js +1 -1
- package/dist/esm/routes/auth-verify-email.js +8 -6
- package/dist/esm/routes/auth.js +1 -1
- package/dist/esm/routes/data-export.js +1 -1
- package/dist/esm/routes/data-get.js +2 -2
- package/dist/esm/routes/data-index-list.js +0 -1
- package/dist/esm/routes/data-query.js +1 -1
- package/dist/esm/routes/data-reflect.js +4 -4
- package/dist/esm/routes/data-schema-get.js +1 -1
- package/dist/esm/routes/data-schemas-list.js +1 -1
- package/dist/esm/routes/data-transaction.js +1 -1
- package/dist/esm/routes/data.js +1 -1
- package/dist/esm/routes/docs.js +56 -54
- package/dist/esm/routes/meta-info.js +8 -12
- package/dist/esm/routes/meta-logs.js +1 -1
- package/dist/esm/routes/oauth2-init.js +8 -5
- package/dist/esm/routes/oauth2-refresh.js +2 -2
- package/dist/esm/routes/oauth2-signin.js +20 -20
- package/dist/esm/routes/webmanager.js +5 -5
- package/dist/esm/rules.js +8 -8
- package/dist/esm/schema/user.js +1 -2
- package/dist/esm/server.js +72 -30
- package/dist/esm/settings/email.js +0 -2
- package/dist/esm/settings/index.js +19 -4
- package/dist/esm/shared/email.js +0 -4
- package/dist/esm/shared/env.js +0 -2
- package/dist/esm/shared/error.js +0 -1
- package/dist/esm/shared/http.js +7 -0
- package/dist/esm/shared/password.js +5 -5
- package/dist/esm/shared/rootpath.js +2 -2
- package/dist/esm/shared/signin.js +6 -6
- package/dist/esm/shared/simple-fetch.js +5 -5
- package/dist/esm/shared/tokens.js +3 -3
- package/dist/esm/start.js +6 -6
- package/dist/esm/websocket/index.js +15 -15
- package/dist/esm/websocket/manager.js +1 -1
- package/dist/esm/websocket/socket.io.js +2 -1
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/logger.d.ts +1 -1
- package/dist/types/middleware/404.d.ts +1 -1
- package/dist/types/middleware/admin-only.d.ts +3 -3
- package/dist/types/middleware/cache.d.ts +1 -1
- package/dist/types/middleware/context.d.ts +1 -1
- package/dist/types/middleware/cors.d.ts +1 -1
- package/dist/types/middleware/swagger.d.ts +1 -1
- package/dist/types/middleware/user.d.ts +1 -1
- package/dist/types/oauth-providers/dropbox.d.ts +1 -1
- package/dist/types/oauth-providers/facebook.d.ts +1 -1
- package/dist/types/oauth-providers/google.d.ts +1 -1
- package/dist/types/oauth-providers/instagram.d.ts +1 -1
- package/dist/types/oauth-providers/spotify.d.ts +1 -1
- package/dist/types/routes/auth-change-password.d.ts +2 -2
- package/dist/types/routes/auth-delete.d.ts +2 -2
- package/dist/types/routes/auth-forgot-password.d.ts +2 -2
- package/dist/types/routes/auth-reset-password.d.ts +2 -2
- package/dist/types/routes/auth-signin.d.ts +2 -2
- package/dist/types/routes/auth-signout.d.ts +2 -2
- package/dist/types/routes/auth-signup.d.ts +2 -2
- package/dist/types/routes/auth-state.d.ts +3 -3
- package/dist/types/routes/auth-update.d.ts +2 -2
- package/dist/types/routes/auth-verify-email.d.ts +2 -2
- package/dist/types/routes/data-exists.d.ts +1 -1
- package/dist/types/routes/data-export.d.ts +1 -1
- package/dist/types/routes/data-get.d.ts +1 -1
- package/dist/types/routes/data-import.d.ts +1 -1
- package/dist/types/routes/data-index-create.d.ts +2 -2
- package/dist/types/routes/data-index-delete.d.ts +1 -1
- package/dist/types/routes/data-index-list.d.ts +2 -2
- package/dist/types/routes/data-query.d.ts +1 -1
- package/dist/types/routes/data-reflect.d.ts +1 -1
- package/dist/types/routes/data-schema-get.d.ts +1 -1
- package/dist/types/routes/data-schema-set.d.ts +1 -1
- package/dist/types/routes/data-schema-test.d.ts +1 -1
- package/dist/types/routes/data-schemas-list.d.ts +1 -1
- package/dist/types/routes/data-set.d.ts +1 -1
- package/dist/types/routes/data-sync-changes.d.ts +1 -1
- package/dist/types/routes/data-sync-mutations.d.ts +1 -1
- package/dist/types/routes/data-transaction.d.ts +2 -2
- package/dist/types/routes/data-update.d.ts +1 -1
- package/dist/types/routes/data.d.ts +1 -1
- package/dist/types/routes/meta-info.d.ts +1 -1
- package/dist/types/routes/meta-logs.d.ts +1 -1
- package/dist/types/routes/meta-ping.d.ts +1 -1
- package/dist/types/routes/meta-stats.d.ts +1 -1
- package/dist/types/routes/oauth2-init.d.ts +1 -1
- package/dist/types/routes/oauth2-refresh.d.ts +1 -1
- package/dist/types/routes/oauth2-signin.d.ts +1 -1
- package/dist/types/routes/webmanager.d.ts +1 -1
- package/dist/types/schema/user.d.ts +2 -2
- package/dist/types/server.d.ts +3 -0
- package/dist/types/settings/index.d.ts +23 -0
- package/dist/types/shared/clients.d.ts +3 -3
- package/dist/types/shared/env.d.ts +2 -1
- package/dist/types/shared/http.d.ts +5 -0
- package/dist/types/shared/signin.d.ts +4 -4
- package/dist/types/shared/validate.d.ts +1 -1
- package/dist/types/websocket/index.d.ts +1 -1
- package/dist/types/websocket/manager.d.ts +1 -1
- package/img/acebase-swagger-ui.png +0 -0
- package/img/acebase-webmanager.png +0 -0
- package/package.json +9 -4
- package/src/routes/auth-signin.yaml +2 -2
- package/webmanager/acebase-client-browser.min.js +8 -11
- package/webmanager/index.html +1 -0
- package/webmanager/index.js +67 -71
- package/.vscode/launch.json +0 -24
- package/create-package-files +0 -25
- package/dist/cjs/auth.js.map +0 -1
- package/dist/cjs/cluster.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/logger.js.map +0 -1
- package/dist/cjs/middleware/404.js.map +0 -1
- package/dist/cjs/middleware/admin-only.js.map +0 -1
- package/dist/cjs/middleware/cache.js.map +0 -1
- package/dist/cjs/middleware/connection.js.map +0 -1
- package/dist/cjs/middleware/context.js.map +0 -1
- package/dist/cjs/middleware/cors.js.map +0 -1
- package/dist/cjs/middleware/swagger.js.map +0 -1
- package/dist/cjs/middleware/user.js.map +0 -1
- package/dist/cjs/oauth-providers/dropbox.js.map +0 -1
- package/dist/cjs/oauth-providers/facebook.js.map +0 -1
- package/dist/cjs/oauth-providers/google.js.map +0 -1
- package/dist/cjs/oauth-providers/index.js.map +0 -1
- package/dist/cjs/oauth-providers/instagram.js.map +0 -1
- package/dist/cjs/oauth-providers/oauth-provider.js.map +0 -1
- package/dist/cjs/oauth-providers/spotify.js.map +0 -1
- package/dist/cjs/routes/auth-change-password.js.map +0 -1
- package/dist/cjs/routes/auth-delete.js.map +0 -1
- package/dist/cjs/routes/auth-forgot-password.js.map +0 -1
- package/dist/cjs/routes/auth-reset-password.js.map +0 -1
- package/dist/cjs/routes/auth-signin.js.map +0 -1
- package/dist/cjs/routes/auth-signout.js.map +0 -1
- package/dist/cjs/routes/auth-signup.js.map +0 -1
- package/dist/cjs/routes/auth-state.js.map +0 -1
- package/dist/cjs/routes/auth-update.js.map +0 -1
- package/dist/cjs/routes/auth-verify-email.js.map +0 -1
- package/dist/cjs/routes/auth.js.map +0 -1
- package/dist/cjs/routes/data-exists.js.map +0 -1
- package/dist/cjs/routes/data-export.js.map +0 -1
- package/dist/cjs/routes/data-get.js.map +0 -1
- package/dist/cjs/routes/data-import.js.map +0 -1
- package/dist/cjs/routes/data-index-create.js.map +0 -1
- package/dist/cjs/routes/data-index-delete.js.map +0 -1
- package/dist/cjs/routes/data-index-list.js.map +0 -1
- package/dist/cjs/routes/data-query.js.map +0 -1
- package/dist/cjs/routes/data-reflect.js.map +0 -1
- package/dist/cjs/routes/data-schema-get.js.map +0 -1
- package/dist/cjs/routes/data-schema-set.js.map +0 -1
- package/dist/cjs/routes/data-schema-test.js.map +0 -1
- package/dist/cjs/routes/data-schemas-list.js.map +0 -1
- package/dist/cjs/routes/data-set.js.map +0 -1
- package/dist/cjs/routes/data-sync-changes.js.map +0 -1
- package/dist/cjs/routes/data-sync-mutations.js.map +0 -1
- package/dist/cjs/routes/data-transaction.js.map +0 -1
- package/dist/cjs/routes/data-update.js.map +0 -1
- package/dist/cjs/routes/data.js.map +0 -1
- package/dist/cjs/routes/docs.js.map +0 -1
- package/dist/cjs/routes/meta-info.js.map +0 -1
- package/dist/cjs/routes/meta-logs.js.map +0 -1
- package/dist/cjs/routes/meta-ping.js.map +0 -1
- package/dist/cjs/routes/meta-stats.js.map +0 -1
- package/dist/cjs/routes/meta.js.map +0 -1
- package/dist/cjs/routes/oauth2-init.js.map +0 -1
- package/dist/cjs/routes/oauth2-refresh.js.map +0 -1
- package/dist/cjs/routes/oauth2-signin.js.map +0 -1
- package/dist/cjs/routes/webmanager.js.map +0 -1
- package/dist/cjs/rules.js.map +0 -1
- package/dist/cjs/schema/user.js.map +0 -1
- package/dist/cjs/server.js.map +0 -1
- package/dist/cjs/settings/email.js.map +0 -1
- package/dist/cjs/settings/index.js.map +0 -1
- package/dist/cjs/shared/clients.js.map +0 -1
- package/dist/cjs/shared/email.js.map +0 -1
- package/dist/cjs/shared/env.js.map +0 -1
- package/dist/cjs/shared/error.js.map +0 -1
- package/dist/cjs/shared/http.js.map +0 -1
- package/dist/cjs/shared/password.js.map +0 -1
- package/dist/cjs/shared/rootpath.js.map +0 -1
- package/dist/cjs/shared/signin.js.map +0 -1
- package/dist/cjs/shared/simple-fetch.js.map +0 -1
- package/dist/cjs/shared/tokens.js.map +0 -1
- package/dist/cjs/shared/validate.js.map +0 -1
- package/dist/cjs/start.js.map +0 -1
- package/dist/cjs/test.js.map +0 -1
- package/dist/cjs/websocket/index.js.map +0 -1
- package/dist/cjs/websocket/manager.js.map +0 -1
- package/dist/cjs/websocket/socket.io.js.map +0 -1
- package/dist/esm/auth.js.map +0 -1
- package/dist/esm/cluster.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/logger.js.map +0 -1
- package/dist/esm/middleware/404.js.map +0 -1
- package/dist/esm/middleware/admin-only.js.map +0 -1
- package/dist/esm/middleware/cache.js.map +0 -1
- package/dist/esm/middleware/connection.js.map +0 -1
- package/dist/esm/middleware/context.js.map +0 -1
- package/dist/esm/middleware/cors.js.map +0 -1
- package/dist/esm/middleware/swagger.js.map +0 -1
- package/dist/esm/middleware/user.js.map +0 -1
- package/dist/esm/oauth-providers/dropbox.js.map +0 -1
- package/dist/esm/oauth-providers/facebook.js.map +0 -1
- package/dist/esm/oauth-providers/google.js.map +0 -1
- package/dist/esm/oauth-providers/index.js.map +0 -1
- package/dist/esm/oauth-providers/instagram.js.map +0 -1
- package/dist/esm/oauth-providers/oauth-provider.js.map +0 -1
- package/dist/esm/oauth-providers/spotify.js.map +0 -1
- package/dist/esm/routes/auth-change-password.js.map +0 -1
- package/dist/esm/routes/auth-delete.js.map +0 -1
- package/dist/esm/routes/auth-forgot-password.js.map +0 -1
- package/dist/esm/routes/auth-reset-password.js.map +0 -1
- package/dist/esm/routes/auth-signin.js.map +0 -1
- package/dist/esm/routes/auth-signout.js.map +0 -1
- package/dist/esm/routes/auth-signup.js.map +0 -1
- package/dist/esm/routes/auth-state.js.map +0 -1
- package/dist/esm/routes/auth-update.js.map +0 -1
- package/dist/esm/routes/auth-verify-email.js.map +0 -1
- package/dist/esm/routes/auth.js.map +0 -1
- package/dist/esm/routes/data-exists.js.map +0 -1
- package/dist/esm/routes/data-export.js.map +0 -1
- package/dist/esm/routes/data-get.js.map +0 -1
- package/dist/esm/routes/data-import.js.map +0 -1
- package/dist/esm/routes/data-index-create.js.map +0 -1
- package/dist/esm/routes/data-index-delete.js.map +0 -1
- package/dist/esm/routes/data-index-list.js.map +0 -1
- package/dist/esm/routes/data-query.js.map +0 -1
- package/dist/esm/routes/data-reflect.js.map +0 -1
- package/dist/esm/routes/data-schema-get.js.map +0 -1
- package/dist/esm/routes/data-schema-set.js.map +0 -1
- package/dist/esm/routes/data-schema-test.js.map +0 -1
- package/dist/esm/routes/data-schemas-list.js.map +0 -1
- package/dist/esm/routes/data-set.js.map +0 -1
- package/dist/esm/routes/data-sync-changes.js.map +0 -1
- package/dist/esm/routes/data-sync-mutations.js.map +0 -1
- package/dist/esm/routes/data-transaction.js.map +0 -1
- package/dist/esm/routes/data-update.js.map +0 -1
- package/dist/esm/routes/data.js.map +0 -1
- package/dist/esm/routes/docs.js.map +0 -1
- package/dist/esm/routes/meta-info.js.map +0 -1
- package/dist/esm/routes/meta-logs.js.map +0 -1
- package/dist/esm/routes/meta-ping.js.map +0 -1
- package/dist/esm/routes/meta-stats.js.map +0 -1
- package/dist/esm/routes/meta.js.map +0 -1
- package/dist/esm/routes/oauth2-init.js.map +0 -1
- package/dist/esm/routes/oauth2-refresh.js.map +0 -1
- package/dist/esm/routes/oauth2-signin.js.map +0 -1
- package/dist/esm/routes/webmanager.js.map +0 -1
- package/dist/esm/rules.js.map +0 -1
- package/dist/esm/schema/user.js.map +0 -1
- package/dist/esm/server.js.map +0 -1
- package/dist/esm/settings/email.js.map +0 -1
- package/dist/esm/settings/index.js.map +0 -1
- package/dist/esm/shared/clients.js.map +0 -1
- package/dist/esm/shared/email.js.map +0 -1
- package/dist/esm/shared/env.js.map +0 -1
- package/dist/esm/shared/error.js.map +0 -1
- package/dist/esm/shared/http.js.map +0 -1
- package/dist/esm/shared/password.js.map +0 -1
- package/dist/esm/shared/rootpath.js.map +0 -1
- package/dist/esm/shared/signin.js.map +0 -1
- package/dist/esm/shared/simple-fetch.js.map +0 -1
- package/dist/esm/shared/tokens.js.map +0 -1
- package/dist/esm/shared/validate.js.map +0 -1
- package/dist/esm/start.js.map +0 -1
- package/dist/esm/test.js.map +0 -1
- package/dist/esm/websocket/index.js.map +0 -1
- package/dist/esm/websocket/manager.js.map +0 -1
- package/dist/esm/websocket/socket.io.js.map +0 -1
- package/dist/types/auth.d.ts.map +0 -1
- package/dist/types/cluster.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/middleware/404.d.ts.map +0 -1
- package/dist/types/middleware/admin-only.d.ts.map +0 -1
- package/dist/types/middleware/cache.d.ts.map +0 -1
- package/dist/types/middleware/connection.d.ts.map +0 -1
- package/dist/types/middleware/context.d.ts.map +0 -1
- package/dist/types/middleware/cors.d.ts.map +0 -1
- package/dist/types/middleware/swagger.d.ts.map +0 -1
- package/dist/types/middleware/user.d.ts.map +0 -1
- package/dist/types/oauth-providers/dropbox.d.ts.map +0 -1
- package/dist/types/oauth-providers/facebook.d.ts.map +0 -1
- package/dist/types/oauth-providers/google.d.ts.map +0 -1
- package/dist/types/oauth-providers/index.d.ts.map +0 -1
- package/dist/types/oauth-providers/instagram.d.ts.map +0 -1
- package/dist/types/oauth-providers/oauth-provider.d.ts.map +0 -1
- package/dist/types/oauth-providers/spotify.d.ts.map +0 -1
- package/dist/types/routes/auth-change-password.d.ts.map +0 -1
- package/dist/types/routes/auth-delete.d.ts.map +0 -1
- package/dist/types/routes/auth-forgot-password.d.ts.map +0 -1
- package/dist/types/routes/auth-reset-password.d.ts.map +0 -1
- package/dist/types/routes/auth-signin.d.ts.map +0 -1
- package/dist/types/routes/auth-signout.d.ts.map +0 -1
- package/dist/types/routes/auth-signup.d.ts.map +0 -1
- package/dist/types/routes/auth-state.d.ts.map +0 -1
- package/dist/types/routes/auth-update.d.ts.map +0 -1
- package/dist/types/routes/auth-verify-email.d.ts.map +0 -1
- package/dist/types/routes/auth.d.ts.map +0 -1
- package/dist/types/routes/data-exists.d.ts.map +0 -1
- package/dist/types/routes/data-export.d.ts.map +0 -1
- package/dist/types/routes/data-get.d.ts.map +0 -1
- package/dist/types/routes/data-import.d.ts.map +0 -1
- package/dist/types/routes/data-index-create.d.ts.map +0 -1
- package/dist/types/routes/data-index-delete.d.ts.map +0 -1
- package/dist/types/routes/data-index-list.d.ts.map +0 -1
- package/dist/types/routes/data-query.d.ts.map +0 -1
- package/dist/types/routes/data-reflect.d.ts.map +0 -1
- package/dist/types/routes/data-schema-get.d.ts.map +0 -1
- package/dist/types/routes/data-schema-set.d.ts.map +0 -1
- package/dist/types/routes/data-schema-test.d.ts.map +0 -1
- package/dist/types/routes/data-schemas-list.d.ts.map +0 -1
- package/dist/types/routes/data-set.d.ts.map +0 -1
- package/dist/types/routes/data-sync-changes.d.ts.map +0 -1
- package/dist/types/routes/data-sync-mutations.d.ts.map +0 -1
- package/dist/types/routes/data-transaction.d.ts.map +0 -1
- package/dist/types/routes/data-update.d.ts.map +0 -1
- package/dist/types/routes/data.d.ts.map +0 -1
- package/dist/types/routes/docs.d.ts.map +0 -1
- package/dist/types/routes/meta-info.d.ts.map +0 -1
- package/dist/types/routes/meta-logs.d.ts.map +0 -1
- package/dist/types/routes/meta-ping.d.ts.map +0 -1
- package/dist/types/routes/meta-stats.d.ts.map +0 -1
- package/dist/types/routes/meta.d.ts.map +0 -1
- package/dist/types/routes/oauth2-init.d.ts.map +0 -1
- package/dist/types/routes/oauth2-refresh.d.ts.map +0 -1
- package/dist/types/routes/oauth2-signin.d.ts.map +0 -1
- package/dist/types/routes/webmanager.d.ts.map +0 -1
- package/dist/types/rules.d.ts.map +0 -1
- package/dist/types/schema/user.d.ts.map +0 -1
- package/dist/types/server.d.ts.map +0 -1
- package/dist/types/settings/email.d.ts.map +0 -1
- package/dist/types/settings/index.d.ts.map +0 -1
- package/dist/types/shared/clients.d.ts.map +0 -1
- package/dist/types/shared/email.d.ts.map +0 -1
- package/dist/types/shared/env.d.ts.map +0 -1
- package/dist/types/shared/error.d.ts.map +0 -1
- package/dist/types/shared/http.d.ts.map +0 -1
- package/dist/types/shared/password.d.ts.map +0 -1
- package/dist/types/shared/rootpath.d.ts.map +0 -1
- package/dist/types/shared/signin.d.ts.map +0 -1
- package/dist/types/shared/simple-fetch.d.ts.map +0 -1
- package/dist/types/shared/tokens.d.ts.map +0 -1
- package/dist/types/shared/validate.d.ts.map +0 -1
- package/dist/types/start.d.ts.map +0 -1
- package/dist/types/test.d.ts.map +0 -1
- package/dist/types/websocket/index.d.ts.map +0 -1
- package/dist/types/websocket/manager.d.ts.map +0 -1
- package/dist/types/websocket/socket.io.d.ts.map +0 -1
- package/src/auth.ts +0 -87
- package/src/cluster.ts +0 -62
- package/src/index.ts +0 -4
- package/src/logger.ts +0 -56
- package/src/middleware/404.ts +0 -13
- package/src/middleware/admin-only.ts +0 -29
- package/src/middleware/cache.ts +0 -15
- package/src/middleware/connection.ts +0 -48
- package/src/middleware/context.ts +0 -23
- package/src/middleware/cors.ts +0 -49
- package/src/middleware/swagger.ts +0 -19
- package/src/middleware/user.ts +0 -51
- package/src/oauth-providers/dropbox.ts +0 -144
- package/src/oauth-providers/facebook.ts +0 -103
- package/src/oauth-providers/google.ts +0 -147
- package/src/oauth-providers/index.ts +0 -21
- package/src/oauth-providers/instagram.ts +0 -98
- package/src/oauth-providers/oauth-provider.ts +0 -65
- package/src/oauth-providers/spotify.ts +0 -127
- package/src/placeholder.d.ts +0 -12
- package/src/routes/auth-change-password.ts +0 -92
- package/src/routes/auth-delete.ts +0 -49
- package/src/routes/auth-forgot-password.ts +0 -77
- package/src/routes/auth-reset-password.ts +0 -96
- package/src/routes/auth-signin.ts +0 -55
- package/src/routes/auth-signout.ts +0 -64
- package/src/routes/auth-signup.ts +0 -164
- package/src/routes/auth-state.ts +0 -20
- package/src/routes/auth-update.ts +0 -149
- package/src/routes/auth-verify-email.ts +0 -75
- package/src/routes/auth.ts +0 -67
- package/src/routes/data-exists.ts +0 -31
- package/src/routes/data-export.ts +0 -51
- package/src/routes/data-get.ts +0 -67
- package/src/routes/data-import.ts +0 -56
- package/src/routes/data-index-create.ts +0 -82
- package/src/routes/data-index-delete.ts +0 -36
- package/src/routes/data-index-list.ts +0 -39
- package/src/routes/data-query.ts +0 -97
- package/src/routes/data-reflect.ts +0 -91
- package/src/routes/data-schema-get.ts +0 -36
- package/src/routes/data-schema-set.ts +0 -35
- package/src/routes/data-schema-test.ts +0 -48
- package/src/routes/data-schemas-list.ts +0 -31
- package/src/routes/data-set.ts +0 -83
- package/src/routes/data-sync-changes.ts +0 -77
- package/src/routes/data-sync-mutations.ts +0 -77
- package/src/routes/data-transaction.ts +0 -166
- package/src/routes/data-update.ts +0 -84
- package/src/routes/data.ts +0 -79
- package/src/routes/docs.ts +0 -249
- package/src/routes/meta-info.ts +0 -80
- package/src/routes/meta-logs.ts +0 -57
- package/src/routes/meta-ping.ts +0 -15
- package/src/routes/meta-stats.ts +0 -31
- package/src/routes/meta.ts +0 -22
- package/src/routes/oauth2-init.ts +0 -44
- package/src/routes/oauth2-refresh.ts +0 -39
- package/src/routes/oauth2-signin.ts +0 -286
- package/src/routes/webmanager.ts +0 -29
- package/src/rules.ts +0 -189
- package/src/schema/user.ts +0 -99
- package/src/server.ts +0 -419
- package/src/settings/email.ts +0 -18
- package/src/settings/index.ts +0 -241
- package/src/shared/clients.ts +0 -31
- package/src/shared/email.ts +0 -33
- package/src/shared/env.ts +0 -38
- package/src/shared/error.ts +0 -37
- package/src/shared/http.ts +0 -26
- package/src/shared/password.ts +0 -41
- package/src/shared/rootpath.ts +0 -17
- package/src/shared/signin.ts +0 -149
- package/src/shared/simple-fetch.ts +0 -65
- package/src/shared/tokens.ts +0 -77
- package/src/shared/validate.ts +0 -53
- package/src/start.ts +0 -48
- package/src/test.ts +0 -10
- package/src/websocket/index.ts +0 -336
- package/src/websocket/manager.ts +0 -46
- package/src/websocket/socket.io.ts +0 -90
- package/tsconfig-cjs.json +0 -11
- package/tsconfig.json +0 -22
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OAuth2Provider } from
|
|
1
|
+
import { OAuth2Provider } from './oauth-provider.js';
|
|
2
2
|
import { fetch } from '../shared/simple-fetch.js';
|
|
3
3
|
export class InstagramAuthProvider extends OAuth2Provider {
|
|
4
4
|
constructor(settings) {
|
|
@@ -24,42 +24,38 @@ export class InstagramAuthProvider extends OAuth2Provider {
|
|
|
24
24
|
const authUrl = `https://api.instagram.com/oauth/authorize/?response_type=code&client_id=${this.settings.client_id}&scope=${encodeURIComponent(this.settings.scopes.join(' '))}&redirect_uri=${encodeURIComponent(info.redirect_url)}&state=${encodeURIComponent(info.state)}`;
|
|
25
25
|
return authUrl;
|
|
26
26
|
}
|
|
27
|
-
getAccessToken(params) {
|
|
27
|
+
async getAccessToken(params) {
|
|
28
28
|
// Request access & refresh tokens with authorization code
|
|
29
|
-
|
|
29
|
+
const response = await fetch(`https://api.instagram.com/oauth/access_token`, {
|
|
30
30
|
method: 'POST',
|
|
31
31
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
32
|
-
body: `client_id=${this.settings.client_id}&client_secret=${this.settings.client_secret}&code=${params.auth_code}&redirect_uri=${encodeURIComponent(params.redirect_url)}
|
|
33
|
-
})
|
|
34
|
-
.then(response => response.json())
|
|
35
|
-
.then((result) => {
|
|
36
|
-
if (result.error) {
|
|
37
|
-
throw new Error(result.error);
|
|
38
|
-
}
|
|
39
|
-
return result;
|
|
32
|
+
body: `client_id=${this.settings.client_id}&client_secret=${this.settings.client_secret}&code=${params.auth_code}&redirect_uri=${encodeURIComponent(params.redirect_url)}`,
|
|
40
33
|
});
|
|
34
|
+
const result = await response.json();
|
|
35
|
+
if (result.error) {
|
|
36
|
+
throw new Error(result.error);
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
41
39
|
}
|
|
42
|
-
getUserInfo(access_token) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
});
|
|
40
|
+
async getUserInfo(access_token) {
|
|
41
|
+
const response = await fetch(`https://api.instagram.com/v1/users/self/?access_token=${access_token}`);
|
|
42
|
+
const result = await response.json();
|
|
43
|
+
if (response.status !== 200) {
|
|
44
|
+
const error = result;
|
|
45
|
+
throw new Error(`${error.code}: ${error.message}`);
|
|
46
|
+
}
|
|
47
|
+
const user = result;
|
|
48
|
+
return {
|
|
49
|
+
id: user.id,
|
|
50
|
+
name: user.full_name,
|
|
51
|
+
display_name: user.username,
|
|
52
|
+
picture: [{ url: user.profile_picture }],
|
|
53
|
+
email: null,
|
|
54
|
+
email_verified: false,
|
|
55
|
+
other: Object.keys(user)
|
|
56
|
+
.filter(key => !['id', 'username', 'full_name', 'profile_picture'].includes(key))
|
|
57
|
+
.reduce((obj, key) => { obj[key] = user[key]; return obj; }, {}),
|
|
58
|
+
};
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
export const AuthProvider = InstagramAuthProvider;
|
|
@@ -11,12 +11,7 @@ export class OAuth2Provider {
|
|
|
11
11
|
this.settings = settings;
|
|
12
12
|
}
|
|
13
13
|
init(info) { throw new NotImplementedError(); }
|
|
14
|
-
;
|
|
15
14
|
getAccessToken(param) { throw new NotImplementedError(); }
|
|
16
|
-
;
|
|
17
|
-
;
|
|
18
15
|
getUserInfo(access_token) { throw new NotImplementedError(); }
|
|
19
|
-
;
|
|
20
|
-
;
|
|
21
16
|
}
|
|
22
17
|
//# sourceMappingURL=oauth-provider.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OAuth2Provider } from
|
|
1
|
+
import { OAuth2Provider } from './oauth-provider.js';
|
|
2
2
|
import { fetch } from '../shared/simple-fetch.js';
|
|
3
3
|
export class SpotifyAuthProvider extends OAuth2Provider {
|
|
4
4
|
constructor(settings) {
|
|
@@ -23,76 +23,70 @@ export class SpotifyAuthProvider extends OAuth2Provider {
|
|
|
23
23
|
const authUrl = `https://accounts.spotify.com/authorize?response_type=code&client_id=${this.settings.client_id}&scope=${encodeURIComponent(this.settings.scopes.join(' '))}&redirect_uri=${encodeURIComponent(info.redirect_url)}&state=${encodeURIComponent(info.state)}`;
|
|
24
24
|
return authUrl;
|
|
25
25
|
}
|
|
26
|
-
getAccessToken(params) {
|
|
26
|
+
async getAccessToken(params) {
|
|
27
27
|
// Request access & refresh tokens with authorization code
|
|
28
|
-
|
|
28
|
+
const response = await fetch('https://accounts.spotify.com/api/token', {
|
|
29
29
|
method: 'POST',
|
|
30
30
|
headers: {
|
|
31
|
-
|
|
31
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
32
32
|
},
|
|
33
33
|
body: `client_id=${this.settings.client_id}&client_secret=${this.settings.client_secret}` +
|
|
34
34
|
(params.type === 'refresh'
|
|
35
35
|
? `&grant_type=refresh_token&refresh_token=${params.refresh_token}`
|
|
36
|
-
: `&grant_type=authorization_code&code=${params.auth_code}&redirect_uri=${encodeURIComponent(params.redirect_url)}`)
|
|
37
|
-
})
|
|
38
|
-
.then(response => response.json())
|
|
39
|
-
.then((result) => {
|
|
40
|
-
if (result.error) {
|
|
41
|
-
throw new Error(result.error);
|
|
42
|
-
}
|
|
43
|
-
const secondsToExpiry = result.expires_in;
|
|
44
|
-
result.expires = new Date(Date.now() + (secondsToExpiry * 1000));
|
|
45
|
-
return result;
|
|
36
|
+
: `&grant_type=authorization_code&code=${params.auth_code}&redirect_uri=${encodeURIComponent(params.redirect_url)}`),
|
|
46
37
|
});
|
|
38
|
+
const result = await response.json();
|
|
39
|
+
if (result.error) {
|
|
40
|
+
throw new Error(result.error);
|
|
41
|
+
}
|
|
42
|
+
const secondsToExpiry = result.expires_in;
|
|
43
|
+
result.expires = new Date(Date.now() + (secondsToExpiry * 1000));
|
|
44
|
+
return result;
|
|
47
45
|
}
|
|
48
|
-
getClientAccessToken() {
|
|
46
|
+
async getClientAccessToken() {
|
|
49
47
|
// Gets client only access to Spotify API, without signed in user
|
|
50
|
-
|
|
48
|
+
const response = await fetch('https://accounts.spotify.com/api/token', {
|
|
51
49
|
method: 'POST',
|
|
52
50
|
headers: {
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
52
|
+
'Authorization': `Basic ${Buffer.from(`${this.settings.client_id}:${this.settings.client_secret}`).toString('base64')}`,
|
|
55
53
|
},
|
|
56
|
-
body: `grant_type=client_credentials
|
|
57
|
-
})
|
|
58
|
-
.then(response => response.json())
|
|
59
|
-
.then((result) => {
|
|
60
|
-
if (result.error) {
|
|
61
|
-
throw new Error(result.error);
|
|
62
|
-
}
|
|
63
|
-
return result;
|
|
54
|
+
body: `grant_type=client_credentials`,
|
|
64
55
|
});
|
|
56
|
+
const result = await response.json();
|
|
57
|
+
if (result.error) {
|
|
58
|
+
throw new Error(result.error);
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
65
61
|
}
|
|
66
|
-
getUserInfo(access_token) {
|
|
67
|
-
|
|
62
|
+
async getUserInfo(access_token) {
|
|
63
|
+
const response = await fetch('https://api.spotify.com/v1/me', {
|
|
68
64
|
method: 'GET',
|
|
69
65
|
headers: {
|
|
70
|
-
|
|
66
|
+
'Authorization': `Bearer ${access_token}`,
|
|
71
67
|
},
|
|
72
|
-
})
|
|
73
|
-
.then(async (response) => {
|
|
74
|
-
const result = await response.json();
|
|
75
|
-
if (response.status !== 200) {
|
|
76
|
-
const error = result;
|
|
77
|
-
throw new Error(`${error.status}: ${error.message}`);
|
|
78
|
-
}
|
|
79
|
-
const user = result;
|
|
80
|
-
return {
|
|
81
|
-
id: user.id,
|
|
82
|
-
name: user.display_name,
|
|
83
|
-
display_name: user.display_name,
|
|
84
|
-
picture: user.images,
|
|
85
|
-
email: user.email,
|
|
86
|
-
email_verified: false,
|
|
87
|
-
other: {
|
|
88
|
-
premium: user.product === 'premium',
|
|
89
|
-
followers: user.followers ? user.followers.total : null,
|
|
90
|
-
country: user.country,
|
|
91
|
-
// external_urls: user.external_urls,
|
|
92
|
-
uri: user.uri
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
68
|
});
|
|
69
|
+
const result = await response.json();
|
|
70
|
+
if (response.status !== 200) {
|
|
71
|
+
const error = result;
|
|
72
|
+
throw new Error(`${error.status}: ${error.message}`);
|
|
73
|
+
}
|
|
74
|
+
const user = result;
|
|
75
|
+
return {
|
|
76
|
+
id: user.id,
|
|
77
|
+
name: user.display_name,
|
|
78
|
+
display_name: user.display_name,
|
|
79
|
+
picture: user.images,
|
|
80
|
+
email: user.email,
|
|
81
|
+
email_verified: false,
|
|
82
|
+
other: {
|
|
83
|
+
premium: user.product === 'premium',
|
|
84
|
+
followers: user.followers ? user.followers.total : null,
|
|
85
|
+
country: user.country,
|
|
86
|
+
// external_urls: user.external_urls,
|
|
87
|
+
uri: user.uri,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
96
90
|
}
|
|
97
91
|
}
|
|
98
92
|
export const AuthProvider = SpotifyAuthProvider;
|
|
@@ -10,7 +10,7 @@ export class ChangePasswordError extends Error {
|
|
|
10
10
|
}
|
|
11
11
|
export const addRoute = (env) => {
|
|
12
12
|
env.app.post(`/auth/${env.db.name}/change_password`, async (req, res) => {
|
|
13
|
-
|
|
13
|
+
const access_token = req.user?.access_token;
|
|
14
14
|
const details = req.body;
|
|
15
15
|
const LOG_ACTION = 'auth.change_password';
|
|
16
16
|
const LOG_DETAILS = { ip: req.ip, uid: details.uid ?? null };
|
|
@@ -31,21 +31,21 @@ export const addRoute = (env) => {
|
|
|
31
31
|
if (!snap.exists()) {
|
|
32
32
|
throw new ChangePasswordError('unknown_uid', `Unknown uid`);
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
const user = snap.val();
|
|
35
35
|
user.uid = snap.key;
|
|
36
|
-
|
|
36
|
+
const hash = user.password_salt ? getPasswordHash(details.password, user.password_salt) : getOldPasswordHash(details.password);
|
|
37
37
|
if (user.password !== hash) {
|
|
38
38
|
throw new ChangePasswordError('wrong_password', `Wrong password`);
|
|
39
39
|
}
|
|
40
40
|
if (access_token && access_token !== user.access_token) {
|
|
41
41
|
throw new ChangePasswordError('wrong_access_token', `Cannot change password while signed in as other user, or with an old token`);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
const pwd = createPasswordHash(details.new_password);
|
|
44
44
|
const updates = {
|
|
45
45
|
access_token: ID.generate(),
|
|
46
46
|
access_token_created: new Date(),
|
|
47
47
|
password: pwd.hash,
|
|
48
|
-
password_salt: pwd.salt
|
|
48
|
+
password_salt: pwd.salt,
|
|
49
49
|
};
|
|
50
50
|
// Update user object
|
|
51
51
|
Object.assign(user, updates);
|
|
@@ -7,7 +7,7 @@ export class DeleteError extends Error {
|
|
|
7
7
|
}
|
|
8
8
|
export const addRoute = (env) => {
|
|
9
9
|
env.app.post(`/auth/${env.db.name}/delete`, async (req, res) => {
|
|
10
|
-
|
|
10
|
+
const details = req.body;
|
|
11
11
|
const LOG_ACTION = 'auth.delete';
|
|
12
12
|
const LOG_DETAILS = { ip: req.ip, uid: req.user?.uid ?? null, delete_uid: details.uid };
|
|
13
13
|
if (!req.user) {
|
|
@@ -38,8 +38,8 @@ export const addRoute = (env) => {
|
|
|
38
38
|
uid: user.uid,
|
|
39
39
|
username: user.username,
|
|
40
40
|
settings: user.settings,
|
|
41
|
-
displayName: user.display_name
|
|
42
|
-
}
|
|
41
|
+
displayName: user.display_name,
|
|
42
|
+
},
|
|
43
43
|
};
|
|
44
44
|
await snap.ref.update({ password_reset_code: user.password_reset_code });
|
|
45
45
|
await env.config.email.send(request).catch(err => {
|
|
@@ -14,12 +14,14 @@ export class ResetPasswordError extends Error {
|
|
|
14
14
|
*/
|
|
15
15
|
export const addRoute = (env) => {
|
|
16
16
|
const resetPassword = async (clientIp, code, newPassword) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const verification = (() => {
|
|
18
|
+
try {
|
|
19
|
+
return parseSignedPublicToken(code, env.tokenSalt);
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
throw new ResetPasswordError('invalid_code', err.message);
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
23
25
|
const snap = await env.authRef.child(verification.uid).get();
|
|
24
26
|
if (!snap.exists()) {
|
|
25
27
|
throw new ResetPasswordError('unknown_user', 'Uknown user');
|
|
@@ -37,7 +39,7 @@ export const addRoute = (env) => {
|
|
|
37
39
|
await snap.ref.update({
|
|
38
40
|
password: pwd.hash,
|
|
39
41
|
password_salt: pwd.salt,
|
|
40
|
-
password_reset_code: null
|
|
42
|
+
password_reset_code: null,
|
|
41
43
|
});
|
|
42
44
|
// Send confirmation email
|
|
43
45
|
const request = {
|
|
@@ -49,8 +51,8 @@ export const addRoute = (env) => {
|
|
|
49
51
|
email: user.email,
|
|
50
52
|
username: user.username,
|
|
51
53
|
displayName: user.display_name,
|
|
52
|
-
settings: user.settings
|
|
53
|
-
}
|
|
54
|
+
settings: user.settings,
|
|
55
|
+
},
|
|
54
56
|
};
|
|
55
57
|
env.config.email?.send(request);
|
|
56
58
|
return user;
|
|
@@ -15,7 +15,7 @@ export const addRoute = (env) => {
|
|
|
15
15
|
// Remove token from cache
|
|
16
16
|
env.authCache.remove(req.user.uid);
|
|
17
17
|
// Remove user binding from all clients signed in with current user
|
|
18
|
-
for (
|
|
18
|
+
for (const client of env.clients.values()) {
|
|
19
19
|
if (client.user?.uid === req.user.uid) {
|
|
20
20
|
client.user = null;
|
|
21
21
|
}
|
|
@@ -67,7 +67,7 @@ export const addRoute = (env) => {
|
|
|
67
67
|
}
|
|
68
68
|
try {
|
|
69
69
|
// Ok, create user
|
|
70
|
-
|
|
70
|
+
const pwd = createPasswordHash(details.password);
|
|
71
71
|
const user = {
|
|
72
72
|
uid: null,
|
|
73
73
|
username: details.username ?? null,
|
|
@@ -83,7 +83,7 @@ export const addRoute = (env) => {
|
|
|
83
83
|
last_signin: new Date(),
|
|
84
84
|
last_signin_ip: req.ip,
|
|
85
85
|
picture: details.picture ?? null,
|
|
86
|
-
settings: details.settings ?? {}
|
|
86
|
+
settings: details.settings ?? {},
|
|
87
87
|
};
|
|
88
88
|
const userRef = await env.authRef.push(user);
|
|
89
89
|
user.uid = userRef.key;
|
|
@@ -100,13 +100,13 @@ export const addRoute = (env) => {
|
|
|
100
100
|
username: user.username,
|
|
101
101
|
email: user.email,
|
|
102
102
|
displayName: user.display_name,
|
|
103
|
-
settings: user.settings
|
|
103
|
+
settings: user.settings,
|
|
104
104
|
},
|
|
105
105
|
date: user.created,
|
|
106
106
|
ip: user.created_ip,
|
|
107
107
|
provider: 'acebase',
|
|
108
108
|
activationCode: createSignedPublicToken({ uid: user.uid }, env.tokenSalt),
|
|
109
|
-
emailVerified: false
|
|
109
|
+
emailVerified: false,
|
|
110
110
|
};
|
|
111
111
|
env.config.email?.send(request).catch(err => {
|
|
112
112
|
env.log.error(LOG_ACTION + '.email', 'unexpected', { ...LOG_DETAILS, request }, err);
|
|
@@ -115,7 +115,7 @@ export const addRoute = (env) => {
|
|
|
115
115
|
const isAdmin = req.user && req.user.uid === 'admin';
|
|
116
116
|
res.send({
|
|
117
117
|
access_token: isAdmin ? '' : createPublicAccessToken(user.uid, req.ip, user.access_token, env.tokenSalt),
|
|
118
|
-
user: getPublicAccountDetails(user)
|
|
118
|
+
user: getPublicAccountDetails(user),
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
catch (err) {
|
|
@@ -9,7 +9,7 @@ export class UpdateError extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
export const addRoute = (env) => {
|
|
11
11
|
env.app.post(`/auth/${env.db.name}/update`, async (req, res) => {
|
|
12
|
-
|
|
12
|
+
const details = req.body;
|
|
13
13
|
const LOG_ACTION = 'auth.update';
|
|
14
14
|
const LOG_DETAILS = { ip: req.ip, uid: req.user?.uid ?? null, update_uid: details.uid ?? null };
|
|
15
15
|
if (!req.user) {
|
|
@@ -15,12 +15,14 @@ export const addRoute = (env) => {
|
|
|
15
15
|
const LOG_ACTION = 'auth.verify_email';
|
|
16
16
|
const verifyEmailAddress = async (clientIp, code) => {
|
|
17
17
|
const LOG_DETAILS = { ip: clientIp, uid: null };
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const verification = (() => {
|
|
19
|
+
try {
|
|
20
|
+
return parseSignedPublicToken(code, env.tokenSalt);
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
throw new VerifyEmailError('invalid_code', err.message);
|
|
24
|
+
}
|
|
25
|
+
})();
|
|
24
26
|
LOG_DETAILS.uid = verification.uid;
|
|
25
27
|
const snap = await env.authRef.child(verification.uid).get();
|
|
26
28
|
if (!snap.exists()) {
|
package/dist/esm/routes/auth.js
CHANGED
|
@@ -10,7 +10,7 @@ export const addRoute = (env) => {
|
|
|
10
10
|
const format = req.query.format || 'json';
|
|
11
11
|
const type_safe = req.query.type_safe !== '0';
|
|
12
12
|
const write = async (chunk) => {
|
|
13
|
-
|
|
13
|
+
const ok = res.write(chunk);
|
|
14
14
|
if (!ok) {
|
|
15
15
|
await new Promise(resolve => res.once('drain', resolve));
|
|
16
16
|
}
|
|
@@ -20,7 +20,7 @@ export const addRoute = (env) => {
|
|
|
20
20
|
}
|
|
21
21
|
if (path === '') {
|
|
22
22
|
// If user has access to the root of database (NOT recommended for others than admin...)
|
|
23
|
-
// Do not return private server data. If the admin user wants access, they should use
|
|
23
|
+
// Do not return private server data. If the admin user wants access, they should use
|
|
24
24
|
// direct requests on those paths (GET /data/dbname/__auth__), or use reflection
|
|
25
25
|
if (options.include) {
|
|
26
26
|
// Remove all includes for private paths
|
|
@@ -41,7 +41,7 @@ export const addRoute = (env) => {
|
|
|
41
41
|
res.send({
|
|
42
42
|
exists: value !== null,
|
|
43
43
|
val: serialized.val,
|
|
44
|
-
map: serialized.map
|
|
44
|
+
map: serialized.map,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
catch (err) {
|
|
@@ -12,12 +12,12 @@ export const addRoute = (env) => {
|
|
|
12
12
|
uid: req.user?.uid !== 'admin' ? null : req.query.impersonate,
|
|
13
13
|
read: {
|
|
14
14
|
allow: false,
|
|
15
|
-
error: null
|
|
15
|
+
error: null,
|
|
16
16
|
},
|
|
17
17
|
write: {
|
|
18
18
|
allow: false,
|
|
19
|
-
error: null
|
|
20
|
-
}
|
|
19
|
+
error: null,
|
|
20
|
+
},
|
|
21
21
|
};
|
|
22
22
|
const impersonatedUser = impersonatedAccess.uid === 'anonymous' ? null : { uid: impersonatedAccess.uid };
|
|
23
23
|
if (impersonatedAccess.uid) {
|
|
@@ -57,7 +57,7 @@ export const addRoute = (env) => {
|
|
|
57
57
|
list && list.forEach(childInfo => {
|
|
58
58
|
childInfo.access = {
|
|
59
59
|
read: env.rules.userHasAccess(impersonatedUser, PathInfo.getChildPath(path, childInfo.key), false).allow,
|
|
60
|
-
write: env.rules.userHasAccess(impersonatedUser, PathInfo.getChildPath(path, childInfo.key), true).allow
|
|
60
|
+
write: env.rules.userHasAccess(impersonatedUser, PathInfo.getChildPath(path, childInfo.key), true).allow,
|
|
61
61
|
};
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -8,7 +8,7 @@ export const addRoute = (env) => {
|
|
|
8
8
|
res.contentType('application/json').send(schemas.map(schema => ({
|
|
9
9
|
path: schema.path,
|
|
10
10
|
schema: typeof schema.schema === 'string' ? schema.schema : schema.text,
|
|
11
|
-
text: schema.text
|
|
11
|
+
text: schema.text,
|
|
12
12
|
})));
|
|
13
13
|
}
|
|
14
14
|
catch (err) {
|
|
@@ -30,7 +30,7 @@ export const addRoutes = (env) => {
|
|
|
30
30
|
timeout: setTimeout(() => {
|
|
31
31
|
_transactions.delete(tx.id);
|
|
32
32
|
tx.finish(); // Finish without value cancels the transaction
|
|
33
|
-
}, TRANSACTION_TIMEOUT_MS)
|
|
33
|
+
}, TRANSACTION_TIMEOUT_MS),
|
|
34
34
|
};
|
|
35
35
|
_transactions.set(tx.id, tx);
|
|
36
36
|
try {
|
package/dist/esm/routes/data.js
CHANGED