diff options
Diffstat (limited to 'src-vue')
-rw-r--r-- | src-vue/src/components/ThunderstoreModCard.vue | 4 | ||||
-rw-r--r-- | src-vue/src/plugins/store.ts | 22 | ||||
-rw-r--r-- | src-vue/src/utils/thunderstore/ThunderstoreMod.d.ts | 12 | ||||
-rw-r--r-- | src-vue/src/utils/thunderstore/ThunderstoreModVersion.d.ts | 9 | ||||
-rw-r--r-- | src-vue/src/views/mods/ThunderstoreModsView.vue | 4 |
5 files changed, 19 insertions, 32 deletions
diff --git a/src-vue/src/components/ThunderstoreModCard.vue b/src-vue/src/components/ThunderstoreModCard.vue index d125e9f5..c9f6768c 100644 --- a/src-vue/src/components/ThunderstoreModCard.vue +++ b/src-vue/src/components/ThunderstoreModCard.vue @@ -66,8 +66,8 @@ <script lang="ts"> import {defineComponent} from "vue"; -import {ThunderstoreMod} from "../utils/thunderstore/ThunderstoreMod"; -import {ThunderstoreModVersion} from "../utils/thunderstore/ThunderstoreModVersion"; +import {ThunderstoreMod} from "../../../src-tauri/bindings/ThunderstoreMod"; +import {ThunderstoreModVersion} from "../../../src-tauri/bindings/ThunderstoreModVersion"; import {invoke, shell} from "@tauri-apps/api"; import {ThunderstoreModStatus} from "../utils/thunderstore/ThunderstoreModStatus"; import {NorthstarMod} from "../../../src-tauri/bindings/NorthstarMod"; diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index d4371fb8..e44b1c3f 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -13,7 +13,7 @@ import { open } from '@tauri-apps/api/dialog'; import { Store } from 'tauri-plugin-store-api'; import { router } from "../main"; import { ReleaseInfo } from "../../../src-tauri/bindings/ReleaseInfo"; -import { ThunderstoreMod } from '../utils/thunderstore/ThunderstoreMod'; +import { ThunderstoreMod } from "../../../src-tauri/bindings/ThunderstoreMod"; import { NorthstarMod } from "../../../src-tauri/bindings/NorthstarMod"; import { searchModule } from './modules/search'; @@ -242,14 +242,22 @@ export const store = createStore<FlightCoreStore>({ await store.commit('loadInstalledMods'); if (state.thunderstoreMods.length !== 0) return; - const response = await fetch('https://northstar.thunderstore.io/api/v1/package/'); - let mods = JSON.parse(await (await response.blob()).text()); + let mods: ThunderstoreMod[] = []; + await invoke<ThunderstoreMod[]>("query_thunderstore_packages_api") + .then((message) => { + mods = message; + }) + .catch((error) => { + console.error(error); + return; + }); + + if (mods == undefined) { + return; + } // Remove some mods from listing - const removedMods = ['Northstar', 'NorthstarReleaseCandidate', 'r2modman']; - state.thunderstoreMods = mods.filter((mod: ThunderstoreMod) => { - return !removedMods.includes(mod.name) && !mod.is_deprecated; - }); + state.thunderstoreMods = mods; // Retrieve categories from mods state.thunderstoreModsCategories = mods diff --git a/src-vue/src/utils/thunderstore/ThunderstoreMod.d.ts b/src-vue/src/utils/thunderstore/ThunderstoreMod.d.ts deleted file mode 100644 index 6387c47e..00000000 --- a/src-vue/src/utils/thunderstore/ThunderstoreMod.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ThunderstoreModVersion } from "./ThunderstoreModVersion"; - -export interface ThunderstoreMod { - name: string; - owner: string; - date_updated: string; - rating_score: number; - package_url: string; - is_deprecated: boolean; - versions: ThunderstoreModVersion[]; - categories: string[]; -} diff --git a/src-vue/src/utils/thunderstore/ThunderstoreModVersion.d.ts b/src-vue/src/utils/thunderstore/ThunderstoreModVersion.d.ts deleted file mode 100644 index f53f0362..00000000 --- a/src-vue/src/utils/thunderstore/ThunderstoreModVersion.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface ThunderstoreModVersion { - full_name: string; - description: string; - icon: string; - version_number: string; - download_url: string; - downloads: number; - date_created: string; -} diff --git a/src-vue/src/views/mods/ThunderstoreModsView.vue b/src-vue/src/views/mods/ThunderstoreModsView.vue index aaf15220..19809f3e 100644 --- a/src-vue/src/views/mods/ThunderstoreModsView.vue +++ b/src-vue/src/views/mods/ThunderstoreModsView.vue @@ -46,11 +46,11 @@ <script lang="ts">
import { defineComponent, ref } from 'vue';
-import { ThunderstoreMod } from "../../utils/thunderstore/ThunderstoreMod";
+import { ThunderstoreMod } from "../../../../src-tauri/bindings/ThunderstoreMod";
import ThunderstoreModCard from "../../components/ThunderstoreModCard.vue";
import { ElScrollbar, ScrollbarInstance } from "element-plus";
import { SortOptions } from "../../utils/SortOptions.d";
-import { ThunderstoreModVersion } from '../../utils/thunderstore/ThunderstoreModVersion';
+import { ThunderstoreModVersion } from "../../../../src-tauri/bindings/ThunderstoreModVersion";
export default defineComponent({
name: "ThunderstoreModsView",
|