Compare commits
No commits in common. "master" and "v1.6" have entirely different histories.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -8,9 +8,9 @@
|
|||||||
<meta name="keywords" content="<< .Keywords >>">
|
<meta name="keywords" content="<< .Keywords >>">
|
||||||
<meta name="anthor" content="srcrs">
|
<meta name="anthor" content="srcrs">
|
||||||
<!-- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> -->
|
<!-- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> -->
|
||||||
<link rel="stylesheet" href="static/index.css">
|
<link rel="stylesheet" href="static/index.min.css">
|
||||||
<< if .DarkMode >>
|
<< if .DarkMode >>
|
||||||
<!-- <link rel="stylesheet" href="static/dark-mode.css">-->
|
<link rel="stylesheet" href="static/dark-mode.css">
|
||||||
<< end >>
|
<< end >>
|
||||||
<link rel="icon" href="static/favicon.svg" type="image/x-icon">
|
<link rel="icon" href="static/favicon.svg" type="image/x-icon">
|
||||||
<style>
|
<style>
|
||||||
@ -24,18 +24,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
font-size: 15px;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-align: left;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
background: linear-gradient(to bottom, #007f80, #007070);
|
|
||||||
color: white;
|
|
||||||
line-height: 2em;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 0 0.5em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-item {
|
.list-item {
|
||||||
@ -46,32 +39,32 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.list-item-title {
|
.list-item-title {
|
||||||
display: block;
|
display: flex;
|
||||||
white-space: nowrap;
|
/* white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis; */
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-size: 15px;
|
|
||||||
align-items: center; /* 确保内容垂直居中 */
|
|
||||||
}
|
|
||||||
.title-link {
|
|
||||||
display: block;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
text-align: left;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: black;
|
color: black;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
.feed-col {
|
.feed-col {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -79,12 +72,7 @@
|
|||||||
<div id="app">
|
<div id="app">
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<h1>
|
<h1>RSS Reader</h1>
|
||||||
RSS Reader
|
|
||||||
<< if gt .AutoUpdatePush 0 >>
|
|
||||||
<span v-show="isPc"><br/>{{ countdown }} s</span>
|
|
||||||
<< end >>
|
|
||||||
</h1>
|
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main v-loading.fullscreen.lock="fullscreenLoading" element-loading-text="拼命加载中">
|
<el-main v-loading.fullscreen.lock="fullscreenLoading" element-loading-text="拼命加载中">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
@ -96,7 +84,7 @@
|
|||||||
<< $feed.Title >>
|
<< $feed.Title >>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<el-scrollbar style="height: 580px;">
|
<el-scrollbar style="height: 300px;">
|
||||||
<< range $i, $item :=$feed.Items >>
|
<< range $i, $item :=$feed.Items >>
|
||||||
<el-list key="<< $i >>">
|
<el-list key="<< $i >>">
|
||||||
<el-list-item>
|
<el-list-item>
|
||||||
@ -125,7 +113,7 @@
|
|||||||
<div slot="header" class="card-header">
|
<div slot="header" class="card-header">
|
||||||
<span>{{ feed.title }}</span>
|
<span>{{ feed.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-scrollbar style="height: 580px;">
|
<el-scrollbar style="height: 300px;">
|
||||||
<el-list v-for="(item, i) in feed.items" :key="i">
|
<el-list v-for="(item, i) in feed.items" :key="i">
|
||||||
<el-list-item>
|
<el-list-item>
|
||||||
<div class="list-item-title">
|
<div class="list-item-title">
|
||||||
@ -135,9 +123,9 @@
|
|||||||
</el-list-item>
|
</el-list-item>
|
||||||
</el-list>
|
</el-list>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<!-- <div slot="footer" class="card-footer" style="height: 10px;">-->
|
<div slot="footer" class="card-footer" style="height: 10px;">
|
||||||
<!-- <time class="time">{{ feed.custom.lastupdate }}</time>-->
|
<time class="time">{{ feed.custom.lastupdate }}</time>
|
||||||
<!-- </div>-->
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -162,15 +150,10 @@
|
|||||||
feeds: [],
|
feeds: [],
|
||||||
showSEOFlag: true,
|
showSEOFlag: true,
|
||||||
fullscreenLoading: true,
|
fullscreenLoading: true,
|
||||||
countdown: 60,
|
|
||||||
isPc: true,
|
|
||||||
autoUpdatePush: << .AutoUpdatePush >>,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
this.fullscreenLoading = false;
|
this.fullscreenLoading = false;
|
||||||
// 使用媒体查询判断设备类型
|
|
||||||
this.isPc = !window.matchMedia('(max-width: 767px)').matches;
|
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
||||||
@ -186,39 +169,17 @@
|
|||||||
}
|
}
|
||||||
this.showSEOFlag = false;
|
this.showSEOFlag = false;
|
||||||
};
|
};
|
||||||
const reloadHtml = () => {
|
|
||||||
if (socket.readyState === WebSocket.CLOSED || socket.readyState === WebSocket.CLOSING) {
|
|
||||||
if (document.visibilityState === 'visible') {
|
|
||||||
// 刷新网页
|
|
||||||
console.log("reload...")
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
socket.onclose = event => {
|
socket.onclose = event => {
|
||||||
if (this.isPc && this.autoUpdatePush > 0) {
|
|
||||||
console.log("WebSocket closed. Reconnecting...");
|
console.log("WebSocket closed. Reconnecting...");
|
||||||
setInterval(reloadHtml, 3000);
|
setTimeout(connect, 300000);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
// Send heartbeat message every 60 seconds
|
// Send heartbeat message every 120 seconds
|
||||||
const sendHeartbeat = () => {
|
const sendHeartbeat = () => {
|
||||||
if (socket.readyState === WebSocket.OPEN) {
|
if (socket.readyState === WebSocket.OPEN) {
|
||||||
socket.send("heartbeat");
|
socket.send("heartbeat");
|
||||||
} else if (socket.readyState === WebSocket.CLOSED || socket.readyState === WebSocket.CLOSING) {
|
|
||||||
reloadHtml()
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (this.isPc && this.autoUpdatePush > 0) {
|
setInterval(sendHeartbeat, 120000);
|
||||||
setInterval(sendHeartbeat, 60000);
|
|
||||||
setInterval(() => {
|
|
||||||
if (this.countdown > 0) {
|
|
||||||
this.countdown--;
|
|
||||||
} else {
|
|
||||||
this.countdown = 60;
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
connect();
|
connect();
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
main.go
2
main.go
@ -67,12 +67,10 @@ func tplHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
Keywords string
|
Keywords string
|
||||||
RssDataList []models.Feed
|
RssDataList []models.Feed
|
||||||
DarkMode bool
|
DarkMode bool
|
||||||
AutoUpdatePush int
|
|
||||||
}{
|
}{
|
||||||
Keywords: getKeywords(),
|
Keywords: getKeywords(),
|
||||||
RssDataList: utils.GetFeeds(),
|
RssDataList: utils.GetFeeds(),
|
||||||
DarkMode: darkMode,
|
DarkMode: darkMode,
|
||||||
AutoUpdatePush: globals.RssUrls.AutoUpdatePush,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 渲染模板并将结果写入响应
|
// 渲染模板并将结果写入响应
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user