Compare commits
No commits in common. "40a181dbcbbbc99fb13e31b3d12417e98c40fe77" and "05d68f10b6860609eff1418d55a9a016e9971b4a" have entirely different histories.
40a181dbcb
...
05d68f10b6
BIN
readme/文件同步.png
BIN
readme/文件同步.png
Binary file not shown.
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 362 KiB |
BIN
readme/桌面预览.png
BIN
readme/桌面预览.png
Binary file not shown.
|
Before Width: | Height: | Size: 582 KiB After Width: | Height: | Size: 2.3 MiB |
BIN
readme/语音摄像头.png
BIN
readme/语音摄像头.png
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 356 KiB |
114
vite.config.ts
114
vite.config.ts
@ -1,107 +1,45 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from 'vite'
|
||||||
import basicSsl from "@vitejs/plugin-basic-ssl";
|
import basicSsl from '@vitejs/plugin-basic-ssl'
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from '@vitejs/plugin-vue'
|
||||||
import { VitePWA } from "vite-plugin-pwa";
|
import { VitePWA } from 'vite-plugin-pwa'
|
||||||
import {
|
|
||||||
copyFileSync,
|
|
||||||
mkdirSync,
|
|
||||||
writeFileSync,
|
|
||||||
readdirSync,
|
|
||||||
cpSync,
|
|
||||||
} from "node:fs";
|
|
||||||
|
|
||||||
const siteUrl = "https://explorer.kuraa.cc";
|
|
||||||
|
|
||||||
function generateStaticFiles() {
|
|
||||||
return {
|
|
||||||
name: "generate-static-files",
|
|
||||||
closeBundle() {
|
|
||||||
const aboutDir = new URL("./dist/about/", import.meta.url);
|
|
||||||
mkdirSync(aboutDir, { recursive: true });
|
|
||||||
cpSync(
|
|
||||||
new URL("./static/", import.meta.url),
|
|
||||||
new URL("./dist/static/", import.meta.url),
|
|
||||||
{
|
|
||||||
recursive: true,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
const files = readdirSync(new URL("./readme/", import.meta.url));
|
|
||||||
files.forEach((file) => {
|
|
||||||
copyFileSync(
|
|
||||||
new URL(`./readme/${file}`, import.meta.url),
|
|
||||||
new URL(`./dist/about/${file}`, import.meta.url),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const lastmod = new Date().toISOString().slice(0, 10);
|
|
||||||
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
|
|
||||||
<url>
|
|
||||||
<loc>${siteUrl}/</loc>
|
|
||||||
<lastmod>${lastmod}</lastmod>
|
|
||||||
<changefreq>weekly</changefreq>
|
|
||||||
<priority>1.0</priority>
|
|
||||||
</url>
|
|
||||||
<url>
|
|
||||||
<loc>${siteUrl}/about/</loc>
|
|
||||||
<lastmod>${lastmod}</lastmod>
|
|
||||||
<changefreq>monthly</changefreq>
|
|
||||||
<priority>0.8</priority>
|
|
||||||
</url>
|
|
||||||
</urlset>
|
|
||||||
`;
|
|
||||||
const robots = `User-agent: *
|
|
||||||
Allow: /
|
|
||||||
|
|
||||||
Sitemap: ${siteUrl}/sitemap.xml
|
|
||||||
`;
|
|
||||||
|
|
||||||
writeFileSync(new URL("./dist/sitemap.xml", import.meta.url), sitemap);
|
|
||||||
writeFileSync(new URL("./dist/robots.txt", import.meta.url), robots);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: "./",
|
base: './',
|
||||||
build: {
|
build: {
|
||||||
// 开发阶段启用源码映射:https://uniapp.dcloud.net.cn/tutorial/migration-to-vue3.html#需主动开启-sourcemap
|
// 开发阶段启用源码映射:https://uniapp.dcloud.net.cn/tutorial/migration-to-vue3.html#需主动开启-sourcemap
|
||||||
sourcemap: process.env.NODE_ENV === "development",
|
sourcemap: process.env.NODE_ENV === 'development',
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
basicSsl(),
|
basicSsl(),
|
||||||
generateStaticFiles(),
|
|
||||||
VitePWA({
|
VitePWA({
|
||||||
registerType: "autoUpdate",
|
registerType: 'autoUpdate',
|
||||||
manifest: {
|
manifest: {
|
||||||
name: "P2P Explorer",
|
name: 'P2P Explorer',
|
||||||
short_name: "P2P Explorer",
|
short_name: 'P2P Explorer',
|
||||||
description: "P2P文件传输与浏览工具",
|
description: 'P2P文件传输与浏览工具',
|
||||||
theme_color: "#f5f5f5", //米色
|
theme_color: '#f5f5f5',//米色
|
||||||
background_color: "#f5f5f5",
|
background_color: '#f5f5f5',
|
||||||
icons: [
|
icons: [
|
||||||
{
|
{
|
||||||
src: "/static/icon64.png",
|
src: '/static/icon64.png',
|
||||||
sizes: "64x64",
|
sizes: '64x64',
|
||||||
type: "image/png",
|
type: 'image/png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: "/static/icon256.png",
|
src: '/static/icon256.png',
|
||||||
sizes: "256x256",
|
sizes: '256x256',
|
||||||
type: "image/png",
|
type: 'image/png'
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
workbox: {
|
workbox: {
|
||||||
globPatterns: ["**/*.{js,css,html,ico,png,svg,webp}"],
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,webp}'],
|
||||||
navigateFallbackDenylist: [/^\/about(?:\/|$)/],
|
runtimeCaching: []
|
||||||
runtimeCaching: [],
|
}
|
||||||
},
|
})
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
server: {
|
server: {
|
||||||
host: "0.0.0.0",
|
host: '0.0.0.0',
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user