Skip to content

Commit 38611ae

Browse files
committed
常规更新
1 parent 38d6c92 commit 38611ae

File tree

11 files changed

+285
-90
lines changed

11 files changed

+285
-90
lines changed

config/articles.db

0 Bytes
Binary file not shown.

config/dev-app-update.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
provider: generic
2-
url: https://coder163.com/rss-reader
2+
url: https://disk.coder163.com/directlink/software/rss-reader/update/
33
updaterCacheDirName: cache

config/index/index.html

-11
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,7 @@
55
</head>
66
<body>
77

8-
<h2>RSS解决的痛点</h2>
98

10-
<ul>
11-
<li>信息分散:为了获取多个信息,需要去多个渠道</li>
12-
<li>渠道质量:自己阅历有限,找到的渠道也不一定是比较好的</li>
13-
<li>信息泛滥:一个渠道里包含信息过多,自己真的感兴趣的可能被淹没其中</li>
14-
<li>时效性低:需要自己主动去寻找时,才可能看到信息,离它刚出现的时间已经很久</li>
15-
<li>没有渠道:有些信息并没有明确渠道提供,除了主动通过比如搜索引擎等方式去寻找,一般也就放弃了</li>
16-
<li>耗时费劲:操作繁杂、寻找费时、筛选费劲、还得时时关注</li>
17-
18-
</ul>
19-
<h2>聊聊怎么使用</h2>
209
<p>
2110
当前阅读器理论上支持RSS的1.0版(代表为博客园)和2.0版协议(代表为CSDN)的解析。
2211
</p>

electron-builder.json5

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"publish": [
77
{
88
"provider": "generic",
9-
"url": "https://coder163.com/rss-reader",
9+
"url": "https://disk.coder163.com/directlink/software/rss-reader/update/",
1010

1111
}
1212
],

electron/main/index.ts

+210
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
import { app, BrowserWindow, globalShortcut, ipcMain, protocol, shell } from 'electron'
2+
import { release } from 'os'
3+
import { join } from 'path'
4+
import Update from "../update";
5+
6+
7+
8+
// Disable GPU Acceleration for Windows 7
9+
if (release().startsWith('6.1')) app.disableHardwareAcceleration()
10+
11+
// Set application name for Windows 10+ notifications
12+
if (process.platform === 'win32') app.setAppUserModelId(app.getName())
13+
14+
if (!app.requestSingleInstanceLock()) {
15+
app.quit()
16+
process.exit(0)
17+
}
18+
19+
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
20+
21+
export const ROOT_PATH = {
22+
// /dist
23+
dist: join(__dirname, '../..'),
24+
// /dist or /public
25+
public: join(__dirname, app.isPackaged ? '../..' : '../../../public'),
26+
}
27+
28+
let win: BrowserWindow | null = null
29+
// Here, you can also use other preload
30+
const preload = join(__dirname, '../preload/index.js')
31+
log.info(preload)
32+
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin
33+
const url = `http://${process.env['VITE_DEV_SERVER_HOST']}:${process.env['VITE_DEV_SERVER_PORT']}`
34+
const indexHtml = join(ROOT_PATH.dist, 'index.html')
35+
// 禁用当前应用程序的硬件加速
36+
app.disableHardwareAcceleration()
37+
async function createWindow() {
38+
win = new BrowserWindow({
39+
height: 800,
40+
width: 1200,
41+
frame: false,//添加这一行采用无边框窗口
42+
icon: join(ROOT_PATH.public, 'favicon.ico'),
43+
transparent: false,//透明 为true会影响页面缩放
44+
resizable: true,//可否缩放 为false会影响页面缩放
45+
movable: true,//可否移动 为false会影响页面缩放
46+
webPreferences: {
47+
preload,
48+
webSecurity: false,//允许跨域请求
49+
javascript: true,
50+
plugins: true,
51+
nodeIntegration: true,// 是否集成 Nodejs
52+
contextIsolation: false,
53+
webviewTag: true
54+
},
55+
})
56+
//注册全局快捷键
57+
globalShortcut.register('ctrl+l', () => {
58+
win?.webContents.send('key-event-l')
59+
})
60+
win.on('maximize', () => {
61+
win.webContents.send('WINDOW_MAXIMIZE', true)
62+
})
63+
win.on('unmaximize', () => {
64+
win.webContents.send('WINDOW_MAXIMIZE', false)
65+
})
66+
67+
// win.setMenu(null)
68+
if (app.isPackaged) {
69+
// win.setMenu(null)
70+
win.loadFile(indexHtml)
71+
} else {
72+
win.loadURL(url)
73+
74+
}
75+
76+
77+
78+
// Test actively push message to the Electron-Renderer
79+
win.webContents.on('did-finish-load', () => {
80+
win?.webContents.send('main-process-message', new Date().toLocaleString())
81+
})
82+
83+
// Make all links open with the browser, not with the application
84+
win.webContents.setWindowOpenHandler(({ url }) => {
85+
if (url.startsWith('https:')) shell.openExternal(url)
86+
return { action: 'deny' }
87+
})
88+
//引用本地图片问题https://blog.csdn.net/Takayamaaren/article/details/107289994
89+
protocol.interceptFileProtocol('file', (req, callback) => {
90+
const url = req.url.substr(8);
91+
callback(url);
92+
});
93+
}
94+
95+
app.whenReady().then(() => {
96+
createWindow()
97+
//自动更新
98+
Update(win)
99+
})
100+
101+
//主进程错误
102+
process.on('uncaughtException', function (error) {
103+
console.log(error)
104+
})
105+
app.on('window-all-closed', () => {
106+
win = null
107+
if (process.platform !== 'darwin') app.quit()
108+
})
109+
110+
app.on('second-instance', () => {
111+
if (win) {
112+
// Focus on the main window if the user tried to open another
113+
if (win.isMinimized()) win.restore()
114+
win.focus()
115+
}
116+
})
117+
118+
app.on('activate', () => {
119+
const allWindows = BrowserWindow.getAllWindows()
120+
if (allWindows.length) {
121+
allWindows[0].focus()
122+
} else {
123+
createWindow()
124+
125+
}
126+
})
127+
128+
// new window example arg: new windows url
129+
ipcMain.handle('open-win', (event, arg) => {
130+
const childWindow = new BrowserWindow({
131+
webPreferences: {
132+
preload,
133+
},
134+
})
135+
136+
if (app.isPackaged) {
137+
childWindow.loadFile(indexHtml, { hash: arg })
138+
} else {
139+
childWindow.loadURL(`${url}/#${arg}`)
140+
// childWindow.webContents.openDevTools({ mode: "undocked", activate: true })
141+
}
142+
})
143+
144+
145+
ipcMain.on("read-content", (event, url) => {
146+
//通知content.vue渲染
147+
win?.webContents.send('read-content-done', url)
148+
})
149+
ipcMain.on("update-item-list", (event, ...args) => {
150+
151+
//通知content.vue渲染
152+
win?.webContents.send('update-item-list-done', args)
153+
})
154+
155+
156+
ipcMain.on('refresh-sub-list', (event, url) => {
157+
win?.webContents.send('refresh-sub-list-done')
158+
})
159+
// @ts-ignore
160+
import { ChannelMessage } from "../../src/domain/enum"
161+
162+
ipcMain.on(ChannelMessage.WINDOW_OPERATION, (event, operation) => {
163+
switch (operation) {
164+
case 'minimize':
165+
win.minimize();
166+
break
167+
case 'maximize':
168+
if (win.isMaximized()) {
169+
win.restore();
170+
} else {
171+
win.maximize();
172+
}
173+
break
174+
case 'close':
175+
win.destroy()
176+
app.quit();
177+
}
178+
})
179+
180+
/**
181+
* 菜单-更新检查
182+
*/
183+
ipcMain.on(ChannelMessage.CHECK_UPDATES, () => {
184+
// const path = require("path")
185+
// //测试环境下使用自动更新
186+
// Object.defineProperty(app,"isPackaged",{
187+
// get(){
188+
// return true
189+
// }
190+
// })
191+
// if (app.isPackaged) {
192+
// autoUpdater.updateConfigPath = path.join(__dirname, '../../../config/dev-app-update.yml');
193+
// }
194+
195+
autoUpdater.checkForUpdatesAndNotify()
196+
197+
})
198+
199+
import log from './../../src/util/log'
200+
import { autoUpdater } from "electron-updater";
201+
/**
202+
* 菜单-应用设置
203+
*/
204+
ipcMain.on(ChannelMessage.APP_SETTINGS_DIALOG, () => {
205+
206+
win.webContents.send(ChannelMessage.APP_SETTINGS_DIALOG_DONE)
207+
})
208+
ipcMain.on('open-dev-tool', () => {
209+
win.webContents.openDevTools()
210+
})

package.json

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "electron-vue-vite",
3-
"version": "1.0.0",
2+
"name": "rss-reader",
3+
"version": "1.1.0",
44
"main": "dist/electron/main/index.js",
55
"author": "dancingcode",
66
"license": "MIT",
@@ -16,12 +16,10 @@
1616
"@quasar/vite-plugin": "^1.0.10",
1717
"@types/request": "^2.48.8",
1818
"@vitejs/plugin-vue": "^2.3.3",
19-
"axios": "^0.27.2",
2019
"electron": "^19.0.8",
2120
"electron-builder": "^23.1.0",
2221
"highlight.js": "^11.6.0",
2322
"path-browserify": "^1.0.1",
24-
"rimraf": "^3.0.2",
2523
"sass": "~1.26.5",
2624
"sass-loader": "^13.0.2",
2725
"typescript": "^4.7.4",
@@ -38,17 +36,16 @@
3836
"VITE_DEV_SERVER_PORT": 3344
3937
},
4038
"dependencies": {
39+
"axios": "^0.27.2",
4140
"@quasar/extras": "^1.14.3",
42-
"bagpipe": "^0.3.5",
4341
"cheerio": "^1.0.0-rc.12",
4442
"default-passive-events": "^2.0.0",
45-
"download": "^8.0.0",
4643
"electron-log": "^4.4.8",
4744
"electron-updater": "^5.2.1",
4845
"feedparser": "^2.2.10",
49-
"log4js": "^6.6.1",
5046
"quasar": "^2.7.5",
51-
"request": "^2.88.2",
52-
"sqlite3": "^5.0.9"
47+
"sqlite3": "^5.0.9",
48+
"rimraf": "^3.0.2",
49+
"uuid": "^9.0.0"
5350
}
5451
}

src/App.vue

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
<template>
2-
3-
42
<div id="app-home" :style="{ height:( winHeight-32) + 'px' }">
53

64
<!-- 侧边栏 -->
75
<div class="side" :style="{ display: isHide }">
86

97
<q-bar class="q-electron-drag" style="background-color:#ecf0f6;">
10-
<!-- <q-btn flat class="q-electron-drag&#45;&#45;exception">-->
11-
<img src="@/assets/logo.png" class="q-electron-drag--exception"/>
12-
&nbsp;
13-
猿阅
14-
<!-- </q-btn>-->
8+
<!-- <q-btn flat class="q-electron-drag&#45;&#45;exception">-->
9+
<img src="@/assets/logo.png" class="q-electron-drag--exception"/>
10+
&nbsp;
11+
猿阅
12+
<!-- </q-btn>-->
1513
<q-space/>
1614
</q-bar>
1715
<side></side>
@@ -33,7 +31,6 @@
3331
</div>
3432
<setting-dialog/>
3533
<update/>
36-
3734
</template>
3835

3936
<script setup lang="ts">

src/components/SettingDialog.vue

+14-14
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
<!-- 标题栏start -->
77
<q-tabs v-model="tab" dense class="bg-grey-3" align="justify" narrow-indicator>
8-
<q-tab name="source" label="订阅源"/>
9-
<q-tab name="alarms" label="偏好设置"/>
10-
<q-tab name="movies" label="关于"/>
8+
<q-tab name="source" label="订阅源" />
9+
<q-tab name="alarms" label="偏好设置" />
10+
<q-tab name="movies" label="关于" />
1111

12-
<q-btn dense flat icon="close" v-close-popup/>
12+
<q-btn dense flat icon="close" v-close-popup />
1313
</q-tabs>
14-
<q-separator/>
14+
<q-separator />
1515
<!-- 第1个选项卡start -->
1616
<q-tab-panels v-model="tab" animated>
1717

@@ -29,13 +29,13 @@
2929

3030
<q-input v-model="subText" placeholder="订阅地址:" stack-label dense>
3131
<template v-slot:append>
32-
<q-btn round dense flat icon="add" @click="subTitleFocus"/>
32+
<q-btn round dense flat icon="add" @click="subTitleFocus" />
3333
</template>
3434
</q-input>
3535

36-
<q-input v-model="subTitle" placeholder="订阅名称(可自动解析):" stack-label dense/>
36+
<q-input v-model="subTitle" placeholder="订阅名称(可自动解析):" stack-label dense />
3737
<!-- 加载动画 -->
38-
<q-inner-loading :showing="loading" label="正在解析,请稍后..." label-style="font-size: 1.1em"/>
38+
<q-inner-loading :showing="loading" label="正在解析,请稍后..." label-style="font-size: 1.1em" />
3939

4040

4141
</q-tab-panel>
@@ -67,7 +67,7 @@
6767
</q-tab-panel>
6868
<!-- 第3个选项卡start -->
6969
<q-tab-panel name="movies">
70-
<q-img :src="all"/>
70+
<q-img :src="all" />
7171
</q-tab-panel>
7272
</q-tab-panels>
7373

@@ -82,17 +82,17 @@
8282
<script setup lang="ts">
8383
import all from '@/assets/all.png'
8484
85-
import {onMounted, ref, watch} from "vue";
85+
import { onMounted, ref, watch } from "vue";
8686
import TreeServiceImpl from '@/service/source'
8787
import SourceServiceImpl from '@/service/source'
8888
import NodeOption from '@/domain/node'
8989
import Reptile from "@/reptile";
90-
import {ChannelMessage, ResponseCode, SubscriptionType} from "@/domain/enum";
91-
import {feedParse, getUuid} from "@/util/common";
92-
import {logger} from "@/util/log/Log4jsConfig";
90+
import { ChannelMessage, ResponseCode, SubscriptionType } from "@/domain/enum";
91+
import { feedParse, getUuid } from "@/util/common";
92+
9393
import log from "@/util/log";
9494
95-
const {ipcRenderer} = window.require("electron");
95+
const { ipcRenderer } = window.require("electron");
9696
9797
let updateModel = ref(true)
9898

0 commit comments

Comments
 (0)