diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..4099407 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +23 diff --git a/app.vue b/app.vue index b921045..f81c432 100644 --- a/app.vue +++ b/app.vue @@ -6,7 +6,7 @@ diff --git a/components/InitiateAuthModule.vue b/components/InitiateAuthModule.vue index 5f7158c..1f9be6c 100644 --- a/components/InitiateAuthModule.vue +++ b/components/InitiateAuthModule.vue @@ -42,6 +42,31 @@ +
+

Having trouble?

+

+ You can manually enter the token from your web browser. +

+
+ + + Submit + +
+
+
@@ -101,6 +126,10 @@ import { invoke } from "@tauri-apps/api/core"; const loading = ref(false); const error = ref(); +const offerManual = ref(false); +const manualToken = ref(""); +const manualLoading = ref(false); + async function auth() { await invoke("auth_initiate"); } @@ -111,5 +140,23 @@ function authWrapper_wrapper() { loading.value = false; error.value = e; }); + setTimeout(() => { + offerManual.value = true; + }, 10000); +} + +async function continueManual() { + await invoke("manual_recieve_handshake", { token: manualToken.value }); +} + +function continueManual_wrapper() { + loading.value = true; + continueManual() + .catch((e) => { + error.value = e; + }) + .finally(() => { + loading.value = false; + }); } diff --git a/components/PageWidget.vue b/components/PageWidget.vue new file mode 100644 index 0000000..ad9428b --- /dev/null +++ b/components/PageWidget.vue @@ -0,0 +1,7 @@ + diff --git a/composables/downloads.ts b/composables/downloads.ts new file mode 100644 index 0000000..860a8c3 --- /dev/null +++ b/composables/downloads.ts @@ -0,0 +1,27 @@ +import { listen } from "@tauri-apps/api/event"; + +export type QueueState = { + queue: Array<{ id: string; status: string; progress: number | null }>; + status: string; +}; + +export type StatsState = { + speed: number; // Bytes per second + time: number; // Seconds, +}; + +export const useQueueState = () => + useState("queue", () => ({ queue: [], status: "Unknown" })); + +export const useStatsState = () => + useState("stats", () => ({ speed: 0, time: 0 })); + +listen("update_queue", (event) => { + const queue = useQueueState(); + queue.value = event.payload as QueueState; +}); + +listen("update_stats", (event) => { + const stats = useStatsState(); + stats.value = event.payload as StatsState; +}); diff --git a/composables/queue.ts b/composables/queue.ts deleted file mode 100644 index 0487260..0000000 --- a/composables/queue.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { listen } from "@tauri-apps/api/event"; - -export type QueueState = { - queue: Array<{ id: string; status: string, progress: number | null }>; -}; - -export const useQueueState = () => - useState("queue", () => ({ queue: [] })); - -listen("update_queue", (event) => { - const queue = useQueueState(); - queue.value = event.payload as QueueState; -}); diff --git a/composables/state-navigation.ts b/composables/state-navigation.ts index 790d258..f7a9b4b 100644 --- a/composables/state-navigation.ts +++ b/composables/state-navigation.ts @@ -1,4 +1,5 @@ import { listen } from "@tauri-apps/api/event"; +import { data } from "autoprefixer"; import { AppStatus, type AppState } from "~/types"; export function setupHooks() { @@ -18,6 +19,20 @@ export function setupHooks() { router.push("/store"); }); + listen("download_error", (event) => { + createModal( + ModalType.Notification, + { + title: "Drop encountered an error while downloading", + description: `Drop encountered an error while downloading your game: "${( + event.payload as unknown as string + ).toString()}"`, + buttonText: "Close" + }, + (e, c) => c() + ); + }); + /* document.addEventListener("contextmenu", (event) => { diff --git a/package.json b/package.json index 7226f0f..c3f715d 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,9 @@ "@tauri-apps/api": ">=2.0.0", "@tauri-apps/plugin-deep-link": "~2", "@tauri-apps/plugin-dialog": "^2.0.1", + "@tauri-apps/plugin-os": "~2", "@tauri-apps/plugin-shell": ">=2.0.0", "markdown-it": "^14.1.0", - "moment": "^2.30.1", "nuxt": "^3.13.0", "scss": "^0.2.4", "vue": "latest", diff --git a/pages/library.vue b/pages/library.vue index 8acd519..a1838d9 100644 --- a/pages/library.vue +++ b/pages/library.vue @@ -6,29 +6,22 @@ v-for="(nav, navIdx) in navigation" :key="nav.route" :class="[ - 'transition group rounded flex justify-between gap-x-6 py-2 px-3', - navIdx === currentNavigationIndex ? 'bg-zinc-900' : '', + 'transition-all duration-200 rounded-lg flex items-center py-1.5 px-3', + navIdx === currentNavigationIndex + ? 'bg-zinc-800 text-zinc-100' + : 'bg-zinc-900/50 text-zinc-400 hover:bg-zinc-800/70 hover:text-zinc-300', ]" :href="nav.route" > -
+
-
-

- {{ nav.label }} -

-
+

+ {{ nav.label }} +

diff --git a/pages/library/[id]/index.vue b/pages/library/[id]/index.vue index a770ac8..5d828bf 100644 --- a/pages/library/[id]/index.vue +++ b/pages/library/[id]/index.vue @@ -20,8 +20,9 @@ - - - -
- - -
-
- -
-
-
-
- Install {{ game.mName }}? - -
-

- Drop will add {{ game.mName }} to the queue to be - downloaded. While downloading, Drop may use up a large - amount of resources, particularly network bandwidth and - CPU utilisation. -

-
-
-
- -
-
- - Version -
- - {{ - versionOptions[installVersionIndex].versionName - }} - on - {{ - versionOptions[installVersionIndex].platform - }} - - - - - - - -
  • - {{ version.versionName }} on - {{ version.platform }} - - - -
  • -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - There are no supported versions to install. Please - contact your server admin or try again later. -

    -
    -
    -
    -
    - - Install to -
    - - {{ - installDirs[installDir] - }} - - - - - - - -
  • - {{ dir }} - - - -
  • -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -

    - {{ installError }} -

    -
    -
    -
    -
    -
    - - Install - - -
    -
    -
    + + + + diff --git a/pages/queue.vue b/pages/queue.vue index 6572203..52574dd 100644 --- a/pages/queue.vue +++ b/pages/queue.vue @@ -1,18 +1,23 @@