diff options
| -rw-r--r-- | src/routes/start/+server.js | 13 | ||||
| -rw-r--r-- | static/manifest.webmanifest | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/routes/start/+server.js b/src/routes/start/+server.js new file mode 100644 index 00000000..49474c36 --- /dev/null +++ b/src/routes/start/+server.js @@ -0,0 +1,13 @@ +import { auth, get } from "$lib/utils"; +import { redirect } from "@sveltejs/kit"; + +export async function GET({ cookies }) { + let token = cookies.get("token"); + let user; + if (token) { + user = await get("/me", auth(cookies)); + throw redirect(307, `/${user.username}`); + } + + throw redirect(307, "/"); +} diff --git a/static/manifest.webmanifest b/static/manifest.webmanifest index f1cdeec1..1f716600 100644 --- a/static/manifest.webmanifest +++ b/static/manifest.webmanifest @@ -3,7 +3,7 @@ "background_color": "#000", "display": "fullscreen", "scope": "/", - "start_url": "/", + "start_url": "/start", "name": "Coinos", "description": "Bitcoin web wallet", "short_name": "Coinos", |
