Skip to content

Commit

Permalink
feat: 增加一些接口
Browse files Browse the repository at this point in the history
  • Loading branch information
rehiy committed Feb 1, 2024
1 parent 93545e5 commit ae88c41
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 2 deletions.
6 changes: 4 additions & 2 deletions initfs/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

apk add nginx

cp -av /tmp/entrypoint /sbin/
chmod +x /sbin/entrypoint
chmod +x /tmp/entrypoint

cp -av /tmp/entrypoint /sbin/
cp -av /tmp/nginx.conf /etc/nginx/http.d/default.conf

######
Expand All @@ -32,6 +32,8 @@ if [ ! -d /var/www/web ]; then
rm -f master.tar.gz
fi

cp -av /tmp/web/* web/

cd /var/www/web

sed -i "s|Copyright By|$(date +'%Y')|" src/components/Footer.vue
Expand Down
Binary file added initfs/web/public/logo/doubangroup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added initfs/web/public/logo/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added initfs/web/public/logo/neteasemusic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added initfs/web/public/logo/ngabbs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added initfs/web/public/logo/qqmusic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added initfs/web/public/logo/v2ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
221 changes: 221 additions & 0 deletions initfs/web/src/store/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
import { defineStore } from "pinia";

export const mainStore = defineStore("mainData", {
state: () => {
return {
// 系统主题
siteTheme: "light",
siteThemeAuto: true,
// 新闻类别
defaultNewsArr: [
{
label: "哔哩哔哩",
name: "bilibili",
order: 0,
show: true,
},
{
label: "微博",
name: "weibo",
order: 1,
show: true,
},
{
label: "抖音",
name: "douyin",
order: 2,
show: true,
},
{
label: "知乎",
name: "zhihu",
order: 3,
show: true,
},
{
label: "36氪",
name: "36kr",
order: 4,
show: true,
},
{
label: "百度",
name: "baidu",
order: 5,
show: true,
},
{
label: "少数派",
name: "sspai",
order: 6,
show: true,
},
{
label: "IT之家",
name: "ithome",
order: 7,
show: true,
},
{
label: "澎湃新闻",
name: "thepaper",
order: 8,
show: true,
},
{
label: "今日头条",
name: "toutiao",
order: 9,
show: true,
},
{
label: "百度贴吧",
name: "tieba",
order: 10,
show: true,
},
{
label: "稀土掘金",
name: "juejin",
order: 11,
show: true,
},
{
label: "腾讯新闻",
name: "newsqq",
order: 12,
show: true,
},
{
label: "豆瓣",
name: "douban_new",
order: 13,
show: true,
},
{
label: "原神",
name: "genshin",
order: 14,
show: true,
},
{
label: "LOL",
name: "lol",
order: 15,
show: true,
},
{
label: "快手",
name: "kuaishou",
order: 16,
show: true,
},
{
label: "网易新闻",
name: "netease",
order: 17,
show: true,
},
{
label: "微信读书",
name: "weread",
order: 18,
show: true,
},
{
label: "豆瓣讨论小组",
name: "doubangroup",
order: 19,
show: true,
},
{
label: "网易云音乐",
name: "neteasemusic",
order: 20,
show: true,
},
{
label: "QQ音乐热歌榜",
name: "qqmusic",
order: 21,
show: true,
},
{
label: "NGA",
name: "ngabbs",
order: 22,
show: true,
},
{
label: "V2EX",
name: "v2ex",
order: 23,
show: true,
},
{
label: "GitHub Trending",
name: "github",
order: 24,
show: true,
},
],
newsArr: [],
// 链接跳转方式
linkOpenType: "open",
// 页头固定
headerFixed: true,
// 时间数据
timeData: null,
// 字体大小
listFontSize: 14,
};
},
getters: {},
actions: {
// 更改系统主题
setSiteTheme(val) {
$message.info(`已切换至${val === "dark" ? "深色模式" : "浅色模式"}`, {
showIcon: false,
});
this.siteTheme = val;
this.siteThemeAuto = false;
},
// 检查更新
checkNewsUpdate() {
const mainData = JSON.parse(localStorage.getItem("mainData"));
let updatedNum = 0;
if (!mainData) return false;
console.log("列表尝试更新", this.defaultNewsArr, this.newsArr);
// 执行比较并迁移
if (this.newsArr.length > 0) {
for (const newItem of this.defaultNewsArr) {
const exists = this.newsArr.some(
(news) => newItem.label === news.label && newItem.name === news.name
);
if (!exists) {
console.log("列表有更新:", newItem);
updatedNum++;
this.newsArr.push(newItem);
}
}
if (updatedNum) $message.success(`成功更新 ${updatedNum} 个榜单数据`);
} else {
console.log("列表无内容,写入默认");
this.newsArr = this.defaultNewsArr;
}
},
},
persist: [
{
storage: localStorage,
paths: [
"siteTheme",
"siteThemeAuto",
"newsArr",
"linkOpenType",
"headerFixed",
"listFontSize",
],
},
],
});

0 comments on commit ae88c41

Please sign in to comment.