diff --git a/.env b/.env
index 76d52b8..a1241ca 100644
--- a/.env
+++ b/.env
@@ -1,8 +1,14 @@
# 站点名称
VITE_SITE_NAME = "無名の主页"
+VITE_SITE_ANTHOR = "無名"
+VITE_SITE_KEYWORDS = "無名,个人主页"
+VITE_SITE_DES = "一个默默无闻的主页"
VITE_SITE_URL = "imsyy.top"
VITE_SITE_LOGO = "/images/icon/logo.png"
+# 百度统计(若不需要可不填)
+VITE_SITE_BAIDUTONGJI = "14e9f35ff8bc67fd4bcb5f07a6e6655a"
+
# 简介文本
VITE_DESC_HELLO = "Hello World !"
VITE_DESC_TEXT = "一个建立于 21 世纪的小站,存活于互联网的边缘"
@@ -25,8 +31,9 @@ VITE_WEATHER_KEY = "57eaea5833ff1616cfd1ff2c4cf9b58a"
VITE_SITE_START = "2020-10-24"
# 歌曲 API 地址
-## 请参照 https://github.com/imsyy/Meting-API#cloudflare-workers 进行 API 服务部署
+## 请参照 https://github.com/xizeyoupan/Meting-API#deno-deploy 进行 API 服务部署
## 此处提供的服务可能会超量从而无法访问,请自行部署
+## 若使用QQ音乐歌单,歌曲数量最好不要超出50首
## 备用:https://api.wuenci.com/meting/api/
VITE_SONG_API = "https://api-meting.imsyy.top/api"
# 歌曲服务器 ( netease-网易云, tencent-qq音乐 )
diff --git a/README.md b/README.md
index c6de78e..264ccd3 100644
--- a/README.md
+++ b/README.md
@@ -33,13 +33,16 @@
* **安装** [node.js](https://nodejs.org/zh-cn/) **环境**
- > node > 16.16.0
+ > node > 16.16.0
> npm > 8.15.0
* 然后以 **管理员权限** 运行 `cmd` 终端,并 `cd` 到 项目根目录
* 在 `终端` 中输入:
```bash
+# 安装 yarn
+npm install -g yarn
+
# 安装依赖
yarn install
diff --git a/index.html b/index.html
index c3e122d..7061aa8 100644
--- a/index.html
+++ b/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
<%- title %>
@@ -24,16 +24,18 @@
window.location.href =
"https://support.dmeng.net/upgrade-your-browser.html?referrer=" + encodeURIComponent(window.location.href)
+ <% if (tongji) { %>
+ <% } %>
diff --git a/package.json b/package.json
index 0b4d42e..c81c416 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"github": "https://github.com/imsyy/home",
"home": "https://imsyy.top",
"private": true,
- "version": "4.0.2",
+ "version": "4.0.3",
"type": "module",
"scripts": {
"dev": "vite --host",
@@ -16,6 +16,7 @@
"aplayer": "^1.10.1",
"axios": "^1.1.3",
"element-plus": "^2.2.18",
+ "fetch-jsonp": "^1.2.3",
"pinia": "^2.0.23",
"pinia-plugin-persistedstate": "^3.0.0",
"terser": "^5.16.1",
diff --git a/public/socialLinks.json b/public/socialLinks.json
index 625df14..2be8bef 100644
--- a/public/socialLinks.json
+++ b/public/socialLinks.json
@@ -18,9 +18,14 @@
"icon": "/images/icon/email.png",
"tip": "来封 Email ~",
"url": "mailto:one@imsyy.top"
+}, {
+ "name": "Twitter",
+ "icon": "/images/icon/twitter.png",
+ "tip": "你懂的 ~",
+ "url": "https://twitter.com/iimmsyy"
}, {
"name": "Telegram",
"icon": "/images/icon/telegram.png",
"tip": "你懂的 ~",
- "url": "https://twitter.com/iimmsyy"
+ "url": "https://t.me/bottom_user"
}]
\ No newline at end of file
diff --git a/src/api/index.js b/src/api/index.js
index 3bfb168..fa9adc0 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -1,4 +1,5 @@
// import axios from "axios";
+import fetchJsonp from "fetch-jsonp";
/**
* 音乐播放器
@@ -6,9 +7,38 @@
// 获取音乐播放列表
export const getPlayerList = async (server, type, id) => {
- const res = await fetch(`${import.meta.env.VITE_SONG_API}?server=${server}&type=${type}&id=${id}`);
- return await res.json();
-}
+ const res = await fetch(
+ `${import.meta.env.VITE_SONG_API}?server=${server}&type=${type}&id=${id}`
+ );
+ const data = await res.json();
+
+ if (data[0].url.startsWith("@")) {
+ const [handle, jsonpCallback, jsonpCallbackFunction, url] = data[0].url
+ .split("@")
+ .slice(1);
+ const jsonpData = await fetchJsonp(url).then((res) => res.json());
+ const domain = (
+ jsonpData.req_0.data.sip.find((i) => !i.startsWith("http://ws")) ||
+ jsonpData.req_0.data.sip[0]
+ ).replace("http://", "https://");
+
+ return data.map((v, i) => ({
+ title: v.name || v.title,
+ artist: v.artist || v.author,
+ src: domain + jsonpData.req_0.data.midurlinfo[i].purl,
+ pic: v.pic,
+ lrc: v.lrc,
+ }));
+ } else {
+ return data.map((v) => ({
+ title: v.name || v.title,
+ artist: v.artist || v.author,
+ src: v.url,
+ pic: v.pic,
+ lrc: v.lrc,
+ }));
+ }
+};
/**
* 一言
@@ -16,26 +46,27 @@ export const getPlayerList = async (server, type, id) => {
// 获取一言数据
export const getHitokoto = async () => {
- const res = await fetch("https://v1.hitokoto.cn");
- return await res.json();
-}
+ const res = await fetch("https://v1.hitokoto.cn");
+ return await res.json();
+};
/**
* 天气
*/
-
// 获取高德地理位置信息
export const getAdcode = async (key) => {
- const res = await fetch(`https://restapi.amap.com/v3/ip?key=${key}`);
- return await res.json();
-}
+ const res = await fetch(`https://restapi.amap.com/v3/ip?key=${key}`);
+ return await res.json();
+};
// 获取高德地理天气信息
export const getWeather = async (key, city) => {
- const res = await fetch(`https://restapi.amap.com/v3/weather/weatherInfo?key=${key}&city=${city}`);
- return await res.json();
-}
+ const res = await fetch(
+ `https://restapi.amap.com/v3/weather/weatherInfo?key=${key}&city=${city}`
+ );
+ return await res.json();
+};
/**
* 获取配置
@@ -43,6 +74,6 @@ export const getWeather = async (key, city) => {
// 获取社交链接
export const getSocialLinks = async () => {
- const res = await fetch("/socialLinks.json");
- return await res.json();
-}
\ No newline at end of file
+ const res = await fetch("/socialLinks.json");
+ return await res.json();
+};
diff --git a/src/components/Music/test.vue b/src/components/Music/test.vue
deleted file mode 100644
index cd61f3b..0000000
--- a/src/components/Music/test.vue
+++ /dev/null
@@ -1,375 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/Player/index.vue b/src/components/Player/index.vue
index 9f3b49f..0e7c2ed 100644
--- a/src/components/Player/index.vue
+++ b/src/components/Player/index.vue
@@ -18,19 +18,12 @@
@onSelectSong="onSelectSong"
/>
-
+
-
-
\ No newline at end of file
+
diff --git a/src/components/Player/old.vue b/src/components/Player/old.vue
deleted file mode 100644
index 10a0553..0000000
--- a/src/components/Player/old.vue
+++ /dev/null
@@ -1,319 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 6782128..a5ac7a1 100644
--- a/src/main.js
+++ b/src/main.js
@@ -14,4 +14,11 @@ const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
app.use(pinia);
-app.mount('#app')
\ No newline at end of file
+app.mount('#app')
+
+// PWA
+navigator.serviceWorker.addEventListener('controllerchange', () => {
+ // 弹出更新提醒
+ console.log("站点已更新,刷新后生效");
+ ElMessage("站点已更新,刷新后生效");
+})
\ No newline at end of file
diff --git a/vite.config.js b/vite.config.js
index da51a30..735a1dd 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -36,6 +36,10 @@ export default ({
inject: {
data: {
title: loadEnv(mode, process.cwd()).VITE_SITE_NAME,
+ author: loadEnv(mode, process.cwd()).VITE_SITE_ANTHOR,
+ keywords: loadEnv(mode, process.cwd()).VITE_SITE_KEYWORDS,
+ description: loadEnv(mode, process.cwd()).VITE_SITE_DES,
+ tongji: loadEnv(mode, process.cwd()).VITE_SITE_BAIDUTONGJI,
},
},
}),
@@ -46,6 +50,8 @@ export default ({
navigateFallbackAllowlist: [/^index.html$/]
},
workbox: {
+ skipWaiting: true,
+ clientsClaim: true,
runtimeCaching: [{
urlPattern: /(.*?)\.(js|css|woff2|woff|ttf)/, // js / css 静态资源缓存
handler: 'CacheFirst',
@@ -63,9 +69,9 @@ export default ({
],
},
manifest: {
- "name": "無名の主页",
- "short_name": "無名の主页",
- "description": "一个默默无闻的主页",
+ "name": loadEnv(mode, process.cwd()).VITE_SITE_NAME,
+ "short_name": loadEnv(mode, process.cwd()).VITE_SITE_NAME,
+ "description": loadEnv(mode, process.cwd()).VITE_SITE_DES,
"display": "standalone",
"start_url": "/",
"theme_color": "#424242",
diff --git a/yarn.lock b/yarn.lock
index 1fcc6a9..e72b382 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2024,6 +2024,11 @@ fastq@^1.6.0:
dependencies:
reusify "^1.0.4"
+fetch-jsonp@^1.2.3:
+ version "1.2.3"
+ resolved "https://registry.yarnpkg.com/fetch-jsonp/-/fetch-jsonp-1.2.3.tgz#ae99a867095cb1ce5c39fac601d70d1084db122f"
+ integrity sha512-C13k1o7R9JTN1wmhKkrW5bU/00LwixXnkufQUR6Rbf4KCS0i8mycQaovt4WVbHnA2NKgi7Ryp9Whpy/CGcij6Q==
+
filelist@^1.0.1:
version "1.0.4"
resolved "https://registry.npmmirror.com/filelist/-/filelist-1.0.4.tgz"