diff --git a/README.md b/README.md index b5b2950..ac9ae24 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,21 @@ -# sv +# Jonas_Jones Dashboard +This Dashboard connects the settings and configurations of most of the services of my ecosystem -Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). +## Accounts +It is possible for everyone to signup and get access to the settings, however most user scopes aren't available to the default user and need to be granted by an admin user. -## Creating a project +## Settings and Configurations +The following are services that can be configured from the dashboard: -If you're seeing this, you've probably already done this step. Congrats! - -```bash -# create a new project in the current directory -npx sv create - -# create a new project in my-app -npx sv create my-app -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. +| Service Name | Description | Implemented | +| ------------ | ----------- | ----------- | +| accouts.jonasjones.dev | Account Management (scopes, deletion, creation, etc...) | No | +| jonasjones.dev (Projects) | Project Management (update, add, delete) | No | +| Analytics (stats.jonasjones.dev) | Management (delete, graphs) | No | +| Rick-Roll-Tracker | Management (graphs) | No | +| kcomebacks.jonasjones.dev | run scraper, graphs, etc... | No | +| builds.jonasjones.dev | Add, remove, update | No | +| blogs.jonasjones.dev | create, edit, delete Posts | No | +| rss.jonasjones.dev | add, edit, delete entries | No | +| API scripts | run, (probably not much more because security issues like remote code execution etc.) | No | +| aka.jonasjones.dev | add, remove, edit aka entries | No | diff --git a/src/lib/components/AlphaNotice.svelte b/src/lib/components/AlphaNotice.svelte new file mode 100644 index 0000000..45efed4 --- /dev/null +++ b/src/lib/components/AlphaNotice.svelte @@ -0,0 +1,32 @@ +
+

This is an Alpha Version

+

+ Note that this Dashboard is in an alpha state. This means that there are bugs and missing features. + Please report any bugs or issues to the + GitHub repository. +

+
+ + \ No newline at end of file diff --git a/src/utils/session.js b/src/lib/session.js similarity index 51% rename from src/utils/session.js rename to src/lib/session.js index 282cff2..34ae9d5 100644 --- a/src/utils/session.js +++ b/src/lib/session.js @@ -1,3 +1,5 @@ +export const ACCOUNTS_WORKER_URL = 'https://accounts.jonasjones.dev'; + export function getSessionKey() { const match = document.cookie.match(/(^| )sessionKey=([^;]+)/); return match ? match[2] : null; @@ -12,6 +14,20 @@ export function redirectToLogin() { window.location.href = `/login?returnUrl=${currentPath}`; } +export function resetSession() { + document.cookie = `sessionKey=; path=/; max-age=0`; + window.location.href = '/login'; +} + +export function redirectToHome() { + if (getSessionKey()) { + window.location.href = new URLSearchParams(window.location.search).get('returnUrl') || '/'; + console.log(new URLSearchParams(window.location.search).get('returnUrl') || '/') + } else { + console.log(getSessionKey()) + } +} + export function ensureAuthenticated() { if (!getSessionKey()) { redirectToLogin(); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index f726b15..70f59a2 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -6,6 +6,11 @@ let { children } = $props(); + + + + +
@@ -22,33 +27,4 @@ flex-direction: column; min-height: 100vh; } - - main { - flex: 1; - display: flex; - flex-direction: column; - padding: 1rem; - width: 100%; - max-width: 64rem; - margin: 0 auto; - box-sizing: border-box; - } - - footer { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - padding: 12px; - } - - footer a { - font-weight: bold; - } - - @media (min-width: 480px) { - footer { - padding: 12px 0; - } - } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 8623973..1ff5fee 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,7 +1,6 @@

diff --git a/src/routes/Header.svelte b/src/routes/Header.svelte index fd49cc8..21ba401 100644 --- a/src/routes/Header.svelte +++ b/src/routes/Header.svelte @@ -1,6 +1,13 @@
@@ -15,13 +22,16 @@
    - {#if ['/login', '/signup', '/register'].includes(page.url.pathname)} + {#if sessionKey === null}
  • Login
  • Signup
  • +
  • + About +
  • {:else}
  • Home @@ -29,6 +39,9 @@
  • About
  • +
  • + Logout +
  • {/if}
-

About this app

+

About this Dashboard

+ +

- This is a SvelteKit app. You can make your own by typing - the following into your command line and following the prompts: + This is a Dashboard app for my Ecosystem's services. + The list and roadmap of supported services can be viewed in the + README.md + page of the github repository. Thus, the Dashboard is opensource in the same repository.

-
npx sv create
+

+ Signups are allowed to anyone. This is because the default user scope currently has no permissions. + However, the Dashboard is designed to be used with a user scope system. This means that the user scope + will be able to access services that are only available to them. Scopes are granted by an admin account. +

- The page you're looking at is purely static HTML, with no client-side interactivity needed. - Because of that, we don't need to load any JavaScript. Try viewing the page's source, or opening - the devtools network panel and reloading. + Further are the accounts not limited to the Dashboard. They are their own entity, hosted on cloudflare workers. + Thus, the accounts are available to be used in other projects as well. The accounts are also opensource in the + github repository. +

+ +

+ Tldr; Dashboard is opensource and signup is public but has no permissions, unless explicitly granted by an admin.

diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index b050e2f..86527e3 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -1,15 +1,21 @@ + +
+

Logging out...

+

Redirecting to the login page...

+
\ No newline at end of file diff --git a/src/routes/signup/+page.svelte b/src/routes/signup/+page.svelte index 26815bb..8ff4f50 100644 --- a/src/routes/signup/+page.svelte +++ b/src/routes/signup/+page.svelte @@ -1,7 +1,8 @@