diff options
Diffstat (limited to '')
-rw-r--r-- | .github/workflows/build.yaml | 2 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | clients/www/LICENSE (renamed from LICENSE) | 0 | ||||
-rw-r--r-- | clients/www/package.json | 4 | ||||
-rw-r--r-- | clients/www/src/lib/components/ReloadPrompt.svelte | 32 | ||||
-rw-r--r-- | clients/www/src/lib/offlineToast.ts | 33 | ||||
-rw-r--r-- | clients/www/src/routes/+layout.svelte | 9 | ||||
-rw-r--r-- | clients/www/src/routes/+page.svelte | 4 | ||||
-rw-r--r-- | clients/www/svelte.config.js | 2 | ||||
-rw-r--r-- | package.json | 3 | ||||
-rw-r--r-- | packages/zorascript/package.json | 2 | ||||
-rw-r--r-- | packages/zorascript/src/enums.ts | 6 |
12 files changed, 56 insertions, 46 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9db02d6..4ea736b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -36,7 +36,7 @@ jobs: - name: Install dependencies run: pnpm -r install - name: Build the site - run: pnpm -F website build + run: pnpm -F zorascript-web build - name: Upload Artifacts uses: actions/upload-pages-artifact@v2 with: diff --git a/README.md b/README.md new file mode 100644 index 0000000..5553d6b --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Zelda - Oracle Password Client for JavaScript/TypeScript + +This repository is currently composed of two projects: \ +1. [zorascript](./packages/zorascript) - A JavaScript/TypeScript library for generating and validating passwords. +2. [zorascript-web](./clients/www) - A SvelteKit-based web client for generating and validating passwords.
\ No newline at end of file diff --git a/LICENSE b/clients/www/LICENSE index f328a5d..f328a5d 100644 --- a/LICENSE +++ b/clients/www/LICENSE diff --git a/clients/www/package.json b/clients/www/package.json index ec7075a..7a84ae8 100644 --- a/clients/www/package.json +++ b/clients/www/package.json @@ -1,6 +1,6 @@ { - "name": "website", - "description": "The actual website", + "name": "zorascript-web", + "description": "A Svelte interface for ZoraScript", "version": "0.0.1", "private": true, "license": "MIT", diff --git a/clients/www/src/lib/components/ReloadPrompt.svelte b/clients/www/src/lib/components/ReloadPrompt.svelte new file mode 100644 index 0000000..e6effbb --- /dev/null +++ b/clients/www/src/lib/components/ReloadPrompt.svelte @@ -0,0 +1,32 @@ +<script lang="ts"> + import { getToastStore } from '@skeletonlabs/skeleton' + import { useRegisterSW } from 'virtual:pwa-register/svelte' + + const toastStore = getToastStore() + + const { updateServiceWorker } = useRegisterSW({ + onRegisteredSW(r) { + console.log('SW Registered: ', r) + }, + onNeedRefresh() { + toastStore.trigger({ + message: 'A new version of the application is available.', + autohide: false, + action: { + label: 'Refresh', + response: updateServiceWorker, + }, + }) + }, + onOfflineReady() { + toastStore.trigger({ + background: 'variant-filled-success', + message: 'Now ready for offline use!', + timeout: 5000, + }) + }, + onRegisterError(err) { + console.error('SW Registration Error: ', err) + }, + }) +</script> diff --git a/clients/www/src/lib/offlineToast.ts b/clients/www/src/lib/offlineToast.ts deleted file mode 100644 index 3ae943e..0000000 --- a/clients/www/src/lib/offlineToast.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { getToastStore, type ToastSettings } from '@skeletonlabs/skeleton'; - -const toastStore = getToastStore(); - -const offline: ToastSettings = { - message: 'You are currently offline.', - background: 'variant-filled-error', - autohide: false -}; - -const online: ToastSettings = { - message: 'You are back online.', - background: 'variant-filled-success', - autohide: true, - timeout: 3000 -}; - -/** - * Make a toast for if the PWA is ever brought offline for whatever reason. - */ -export default function offlineToast() { - window.addEventListener('offline', () => { - toastStore.clear(); - toastStore.trigger(offline); - }); - - window.addEventListener('online', () => { - toastStore.clear(); - setTimeout(() => { - toastStore.trigger(online); - }, 300); - }); -} diff --git a/clients/www/src/routes/+layout.svelte b/clients/www/src/routes/+layout.svelte index 15780c3..12996ec 100644 --- a/clients/www/src/routes/+layout.svelte +++ b/clients/www/src/routes/+layout.svelte @@ -1,4 +1,5 @@ <script lang="ts"> + import { base } from '$app/paths'; import '../app.postcss'; import { AppShell, AppBar, LightSwitch, initializeStores } from '@skeletonlabs/skeleton'; @@ -22,12 +23,16 @@ <svelte:fragment slot="lead"> <LightSwitch /> </svelte:fragment> - <a href="#">Zelda: Oracle Password Generator</a> + <a href="{base}/">Zelda: Oracle Password Generator</a> <svelte:fragment slot="trail"> - <a href="#">TODO: SOURCE CODE</a> + <a href="https://github.com/RosstheRoss/zorascript">TODO: SOURCE CODE</a> </svelte:fragment> </AppBar> </svelte:fragment> <!-- Page Route Content --> <slot /> </AppShell> + +{#await import('$lib/components/ReloadPrompt.svelte') then { default: ReloadPrompt }} + <ReloadPrompt /> +{/await} diff --git a/clients/www/src/routes/+page.svelte b/clients/www/src/routes/+page.svelte index 2ea190a..84d1c45 100644 --- a/clients/www/src/routes/+page.svelte +++ b/clients/www/src/routes/+page.svelte @@ -1 +1,3 @@ -TODO: Draw the rest of the owl
\ No newline at end of file +<svelte:head> + <title>Zelda: Oracle of [Ages,Seasons] Passphrase Generator</title> +</svelte:head>
\ No newline at end of file diff --git a/clients/www/svelte.config.js b/clients/www/svelte.config.js index 79982cf..df04fc1 100644 --- a/clients/www/svelte.config.js +++ b/clients/www/svelte.config.js @@ -11,7 +11,7 @@ const config = { kit: { adapter: adapter(), paths: { - base: process.env.NODE_ENV === "production" ? "/oracle-client" : "", + base: process.env.NODE_ENV === "production" ? "/zorascript" : "", } } }; diff --git a/package.json b/package.json index 0c9ecfe..01b9011 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], - "author": "", - "license": "ISC", + "author": "Matt Strapp <matt@mattstrapp.net>", "private": true, "devDependencies": { "eslint": "^8.56.0", diff --git a/packages/zorascript/package.json b/packages/zorascript/package.json index ad5ce4a..ce749e9 100644 --- a/packages/zorascript/package.json +++ b/packages/zorascript/package.json @@ -8,7 +8,7 @@ }, "keywords": [], "author": "Matt Strapp <matt@mattstrapp.net>", - "license": "MIT", + "license": "LGPL-3.0-only", "devDependencies": { } diff --git a/packages/zorascript/src/enums.ts b/packages/zorascript/src/enums.ts index 5d70b62..221292d 100644 --- a/packages/zorascript/src/enums.ts +++ b/packages/zorascript/src/enums.ts @@ -5,7 +5,7 @@ * * In most cases NA and EU are the same, but there are some small differences mainly involving name encoding. */ -const enum GameRegion { +const enum Region { Japan = "JP", NorthAmerica = "NA", Europe = "EU" @@ -19,7 +19,7 @@ const enum Game { Seasons = 1 } -const enum Animal { +const enum AnimalFriend { Ricky = 0x0b, Dimitri = 0x0c, Moosh = 0x0d @@ -28,4 +28,4 @@ const enum Animal { const enum ChildQuestion { NoEgg = 0, YesChicken = 0x2, -}
\ No newline at end of file +} |