Skip to content

Commit c00ec2f

Browse files
committed
Polish settings and mobile layout
1 parent 2ff6f91 commit c00ec2f

7 files changed

Lines changed: 327 additions & 29 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Zijian Zhang
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ Worker 配置在 `wrangler.jsonc`:
8181
- `ALLOWED_HOSTS`:留空表示允许代理所有 http/https RSS 地址;如果要限制来源,可填逗号分隔的主机名。
8282
- `MAX_BYTES`:最大响应体字节数,默认 `8388608`
8383

84+
默认代理模板是 `https://api.plunox.site/rss?url={url}`。该代理不会留存用户信息和请求记录;你也可以在设置中替换为自己的代理地址,或清空后直接请求 RSS 地址。
85+
8486
桌面开发:
8587

8688
```bash
@@ -104,3 +106,7 @@ GitHub Actions 会在 `main` 分支构建 Web 版本,并分别在 Linux、macO
104106
- `RSS_READER_PAGE_TOKEN`:一个能写入 `zijian-z/rss-reader-page` 的 token。
105107

106108
然后在 `zijian-z/rss-reader-page` 仓库里启用 GitHub Pages,发布来源选择 `main` 分支的根目录。启用后通常可以通过 `https://zijian-z.github.io/rss-reader-page/` 访问。
109+
110+
## 许可证
111+
112+
MIT License. 源代码:<https://github.com/zijian-z/rss-reader>

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"private": true,
44
"version": "0.1.0",
55
"description": "A browser and desktop RSS reader built with React and HeroUI.",
6+
"license": "MIT",
67
"author": {
78
"name": "Zijian Zhang",
89
"email": "zijian-zhang@outlook.com"

src/App.jsx

Lines changed: 69 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ const dateOnlyFormatter = new Intl.DateTimeFormat("zh-CN", {
4343
day: "numeric",
4444
});
4545

46+
const ACCENT_OPTIONS = [
47+
{ value: "blue", label: "蓝色" },
48+
{ value: "slate", label: "石墨" },
49+
{ value: "violet", label: "紫色" },
50+
{ value: "rose", label: "玫瑰" },
51+
{ value: "amber", label: "琥珀" },
52+
];
53+
4654
function App() {
4755
const [library, setLibrary] = useState(loadLibrary);
4856
const [mobilePane, setMobilePane] = useState("sources");
@@ -381,7 +389,10 @@ function App() {
381389
};
382390

383391
return (
384-
<div className={`app ${library.config.density}`} style={cssVars}>
392+
<div
393+
className={`app ${library.config.density} accent-${library.config.accentColor || "blue"}`}
394+
style={cssVars}
395+
>
385396
<header className="topbar">
386397
<nav className="mobile-switch" aria-label="移动端视图">
387398
<button
@@ -582,7 +593,13 @@ function SourcesPane({
582593
</Button>
583594
</Tooltip>
584595
<Tooltip content="添加订阅" placement="right">
585-
<Button isIconOnly color="primary" aria-label="添加订阅" onPress={onAdd}>
596+
<Button
597+
isIconOnly
598+
className="accent-icon-button"
599+
variant="flat"
600+
aria-label="添加订阅"
601+
onPress={onAdd}
602+
>
586603
<Plus size={18} />
587604
</Button>
588605
</Tooltip>
@@ -618,7 +635,13 @@ function SourcesPane({
618635
</Button>
619636
</Tooltip>
620637
<Tooltip content="添加订阅">
621-
<Button isIconOnly color="primary" aria-label="添加订阅" onPress={onAdd}>
638+
<Button
639+
isIconOnly
640+
className="accent-icon-button"
641+
variant="flat"
642+
aria-label="添加订阅"
643+
onPress={onAdd}
644+
>
622645
<Plus size={18} />
623646
</Button>
624647
</Tooltip>
@@ -988,7 +1011,7 @@ function AddFeedDialog({ folders, onClose, onSubmit }) {
9881011
<Button variant="flat" onPress={onClose}>
9891012
取消
9901013
</Button>
991-
<Button color="primary" type="submit">
1014+
<Button className="accent-button" type="submit">
9921015
添加
9931016
</Button>
9941017
</div>
@@ -1047,7 +1070,7 @@ function EditFeedDialog({ feed, folders, onClose, onSubmit }) {
10471070
<Button variant="flat" onPress={onClose}>
10481071
取消
10491072
</Button>
1050-
<Button color="primary" type="submit">
1073+
<Button className="accent-button" type="submit">
10511074
保存
10521075
</Button>
10531076
</div>
@@ -1094,9 +1117,12 @@ function SettingsDialog({
10941117
<input
10951118
value={config.proxyTemplate}
10961119
onChange={(event) => onConfigChange({ proxyTemplate: event.target.value })}
1097-
placeholder="https://proxy.example/raw?url={url}"
1120+
placeholder="留空则直接请求 RSS 地址"
10981121
type="text"
10991122
/>
1123+
<small className="field-note">
1124+
默认代理不会留存用户信息和请求记录;也可以替换为自己的代理地址,或清空后直接请求 RSS。
1125+
</small>
11001126
</label>
11011127
</section>
11021128

@@ -1148,6 +1174,19 @@ function SettingsDialog({
11481174
<option value="dark">深色</option>
11491175
</select>
11501176
</label>
1177+
<label>
1178+
<span>强调色</span>
1179+
<select
1180+
value={config.accentColor || "blue"}
1181+
onChange={(event) => onConfigChange({ accentColor: event.target.value })}
1182+
>
1183+
{ACCENT_OPTIONS.map((option) => (
1184+
<option key={option.value} value={option.value}>
1185+
{option.label}
1186+
</option>
1187+
))}
1188+
</select>
1189+
</label>
11511190
<label>
11521191
<span>密度</span>
11531192
<select
@@ -1195,24 +1234,42 @@ function SettingsDialog({
11951234
</Button>
11961235
</section>
11971236

1198-
<section>
1237+
<section className="data-section">
11991238
<h3>数据</h3>
1200-
<div className="data-actions">
1201-
<Button startContent={<Download size={17} />} variant="flat" onPress={onExport}>
1239+
<div className="data-action-grid">
1240+
<Button
1241+
className="data-action-button"
1242+
startContent={<Download size={17} />}
1243+
variant="flat"
1244+
onPress={onExport}
1245+
>
12021246
导出 JSON
12031247
</Button>
1204-
<Button startContent={<Upload size={17} />} variant="flat" onPress={onImportClick}>
1248+
<Button
1249+
className="data-action-button"
1250+
startContent={<Upload size={17} />}
1251+
variant="flat"
1252+
onPress={onImportClick}
1253+
>
12051254
导入 JSON
12061255
</Button>
1207-
<Button color="danger" variant="flat" onPress={onReset}>
1256+
<Button className="data-action-button danger-action" variant="flat" onPress={onReset}>
12081257
重置
12091258
</Button>
12101259
</div>
12111260
</section>
1261+
1262+
<section className="about-section">
1263+
<h3>关于</h3>
1264+
<p>Copyright © 2026 Zijian Zhang. Released under the MIT License.</p>
1265+
<a href="https://github.com/zijian-z/rss-reader" target="_blank" rel="noreferrer">
1266+
github.com/zijian-z/rss-reader
1267+
</a>
1268+
</section>
12121269
</div>
12131270

12141271
<div className="dialog-actions">
1215-
<Button color="primary" onPress={onClose}>
1272+
<Button className="accent-button" onPress={onClose}>
12161273
完成
12171274
</Button>
12181275
</div>

src/lib/library.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { uid } from "./rss.js";
22

33
export const STORAGE_KEY = "rss-reader-library-v1";
4+
export const CURRENT_SCHEMA_VERSION = 2;
5+
export const DEFAULT_PROXY_TEMPLATE = "https://api.plunox.site/rss?url={url}";
46

57
export const DEFAULT_CONFIG = {
68
refreshMinutes: 30,
@@ -9,16 +11,17 @@ export const DEFAULT_CONFIG = {
911
readerWidth: 780,
1012
fontFamily: "system",
1113
theme: "system",
14+
accentColor: "blue",
1215
density: "comfortable",
13-
proxyTemplate: "",
16+
proxyTemplate: DEFAULT_PROXY_TEMPLATE,
1417
};
1518

1619
export function createDefaultLibrary() {
1720
const techFolderId = "folder_tech";
1821
const cultureFolderId = "folder_culture";
1922

2023
return {
21-
schemaVersion: 1,
24+
schemaVersion: CURRENT_SCHEMA_VERSION,
2225
config: { ...DEFAULT_CONFIG },
2326
folders: [
2427
{ id: techFolderId, name: "科技" },
@@ -79,9 +82,14 @@ export function normalizeLibrary(input) {
7982
...DEFAULT_CONFIG,
8083
...(typeof input?.config === "object" && input.config ? input.config : {}),
8184
};
85+
const schemaVersion = Number(input?.schemaVersion || 1);
86+
87+
if (schemaVersion < 2 && !config.proxyTemplate) {
88+
config.proxyTemplate = DEFAULT_PROXY_TEMPLATE;
89+
}
8290

8391
return {
84-
schemaVersion: 1,
92+
schemaVersion: CURRENT_SCHEMA_VERSION,
8593
config,
8694
folders: folders.map(normalizeFolder).filter(Boolean),
8795
feeds: feeds.map(normalizeFeed).filter(Boolean),

0 commit comments

Comments
 (0)