mirror of
https://github.com/spark-store-project/spark-store-abyss
synced 2025-12-17 21:01:38 +08:00
feat: 添加站点配置
This commit is contained in:
18
app.config.ts
Normal file
18
app.config.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
export default defineAppConfig({
|
||||||
|
latestNews: {
|
||||||
|
title: "🎉社区吉祥物「星小火」",
|
||||||
|
link: "https://tai3.cn",
|
||||||
|
},
|
||||||
|
// 不设置 latestRelease 时,默认为构建时从 Gitee 获取的最新版本信息
|
||||||
|
// latestRelease: {
|
||||||
|
// tag_name: "1.0.0",
|
||||||
|
// created_at: "2024-11-01T00:00:00Z",
|
||||||
|
// body: "Initial release of Spark Store.",
|
||||||
|
// assets: [
|
||||||
|
// {
|
||||||
|
// name: "spark-store-1.0.0-amd64.deb",
|
||||||
|
// browser_download_url: "https://example.com/spark-store-1.0.0-amd64.deb",
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
});
|
||||||
16
app.vue
16
app.vue
@@ -2,6 +2,8 @@
|
|||||||
import ScrollPanel from "primevue/scrollpanel";
|
import ScrollPanel from "primevue/scrollpanel";
|
||||||
import Button from "primevue/button";
|
import Button from "primevue/button";
|
||||||
|
|
||||||
|
const appConfig = useAppConfig();
|
||||||
|
|
||||||
const path = computed(() => {
|
const path = computed(() => {
|
||||||
return useRoute().path;
|
return useRoute().path;
|
||||||
});
|
});
|
||||||
@@ -176,9 +178,21 @@ export interface Release {
|
|||||||
body: string;
|
body: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data: latestRelease }: { data: Ref<Release> } = await useFetch(
|
const latestRelease: Ref<Release> = ref({
|
||||||
|
assets: [],
|
||||||
|
tag_name: "",
|
||||||
|
created_at: "",
|
||||||
|
body: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (appConfig.latestRelease) {
|
||||||
|
latestRelease.value = appConfig.latestRelease as Release;
|
||||||
|
} else {
|
||||||
|
const { data: data }: { data: Ref<Release> } = await useFetch(
|
||||||
"https://gitee.com/api/v5/repos/spark-store-project/spark-store/releases/latest"
|
"https://gitee.com/api/v5/repos/spark-store-project/spark-store/releases/latest"
|
||||||
);
|
);
|
||||||
|
latestRelease.value = data.value;
|
||||||
|
}
|
||||||
|
|
||||||
provide("latestRelease", latestRelease);
|
provide("latestRelease", latestRelease);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
16
index.d.ts
vendored
Normal file
16
index.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import type { Release } from "./app.vue";
|
||||||
|
|
||||||
|
declare module "nuxt/schema" {
|
||||||
|
interface AppConfigInput {
|
||||||
|
latestRelease?: Release;
|
||||||
|
latestNews: {
|
||||||
|
title: string;
|
||||||
|
link: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
type AppConfig = AppConfigInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
// It is always important to ensure you import/export something when augmenting a type
|
||||||
|
export {};
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Release } from "~/app.vue";
|
import type { Release } from "~/app.vue";
|
||||||
|
|
||||||
|
const appConfig = useAppConfig();
|
||||||
|
|
||||||
const scrollPanel = inject<Ref<ComponentPublicInstance>>("scrollPanel");
|
const scrollPanel = inject<Ref<ComponentPublicInstance>>("scrollPanel");
|
||||||
const sProgress = ref(0);
|
const sProgress = ref(0);
|
||||||
|
|
||||||
@@ -154,8 +156,10 @@ const latestRelease = inject<Ref<Release>>("latestRelease");
|
|||||||
<p>适用于 Debian 社区和其他 Linux 发行版的社区应用商店;</p>
|
<p>适用于 Debian 社区和其他 Linux 发行版的社区应用商店;</p>
|
||||||
<p>从社区中来,到社区中去,聚星星之火,成燎原之势。</p>
|
<p>从社区中来,到社区中去,聚星星之火,成燎原之势。</p>
|
||||||
<p class="text-lg font-bold text-black dark:text-surface-100">
|
<p class="text-lg font-bold text-black dark:text-surface-100">
|
||||||
🎉社区吉祥物「星小火」
|
{{ appConfig.latestNews.title }}
|
||||||
<a href="https://tai3.cn" class="text-secondary-600">了解更多 →</a>
|
<a :href="appConfig.latestNews.link" class="text-secondary-600"
|
||||||
|
>了解更多 →</a
|
||||||
|
>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user