mirror of
https://github.com/yang991178/fluent-reader.git
synced 2025-02-06 20:33:21 +01:00
commit
b827f268ac
4
.github/workflows/release-linux.yml
vendored
4
.github/workflows/release-linux.yml
vendored
@ -14,9 +14,9 @@ jobs:
|
||||
|
||||
- name: Build and package the app
|
||||
run: |
|
||||
sudo npm install --unsafe-perm=true --allow-root
|
||||
npm install
|
||||
npm run build
|
||||
sudo npm run package-linux
|
||||
npm run package-linux
|
||||
|
||||
- name: Get app version
|
||||
id: package-version
|
||||
|
4
dist/styles/cards.css
vendored
4
dist/styles/cards.css
vendored
@ -91,6 +91,10 @@
|
||||
.card span.h {
|
||||
background: #fce10080;
|
||||
}
|
||||
.card.rtl .snippet,
|
||||
.card.rtl .title {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.default-card {
|
||||
display: inline-block;
|
||||
|
2
dist/styles/main.css
vendored
2
dist/styles/main.css
vendored
@ -209,7 +209,7 @@ img.favicon.dropdown {
|
||||
.main::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: sticky;
|
||||
position: relative;
|
||||
top: var(--navHeight);
|
||||
left: 0;
|
||||
width: calc(100% - 16px);
|
||||
|
@ -1,5 +1,5 @@
|
||||
appId: DevHYLiu.FluentReader
|
||||
buildVersion: 26
|
||||
buildVersion: 27
|
||||
productName: Fluent Reader
|
||||
copyright: Copyright © 2020 Haoyuan Liu
|
||||
files:
|
||||
|
999
package-lock.json
generated
999
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "fluent-reader",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"description": "Modern desktop RSS reader",
|
||||
"main": "./dist/electron.js",
|
||||
"scripts": {
|
||||
@ -27,7 +27,7 @@
|
||||
"@types/react-redux": "^7.1.9",
|
||||
"@yang991178/rss-parser": "^3.8.1",
|
||||
"electron": "^19.0.0",
|
||||
"electron-builder": "^22.11.3",
|
||||
"electron-builder": "^23.0.3",
|
||||
"electron-react-devtools": "^0.5.3",
|
||||
"electron-store": "^5.2.0",
|
||||
"electron-window-state": "^5.0.3",
|
||||
|
@ -3,10 +3,12 @@ import { Card } from "./card"
|
||||
import CardInfo from "./info"
|
||||
import Time from "../utils/time"
|
||||
import Highlights from "./highlights"
|
||||
import { SourceTextDirection } from "../../scripts/models/source"
|
||||
|
||||
const className = (props: Card.Props) => {
|
||||
let cn = ["card", "compact-card"]
|
||||
if (props.item.hidden) cn.push("hidden")
|
||||
if (props.source.textDir === SourceTextDirection.RTL) cn.push("rtl")
|
||||
return cn.join(" ")
|
||||
}
|
||||
|
||||
@ -23,15 +25,10 @@ const CompactCard: React.FunctionComponent<Card.Props> = props => (
|
||||
text={props.item.title}
|
||||
filter={props.filter}
|
||||
title
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</span>
|
||||
<span className="snippet">
|
||||
<Highlights
|
||||
text={props.item.snippet}
|
||||
filter={props.filter}
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
<Highlights text={props.item.snippet} filter={props.filter} />
|
||||
</span>
|
||||
</div>
|
||||
<Time date={props.item.date} />
|
||||
|
@ -2,11 +2,13 @@ import * as React from "react"
|
||||
import { Card } from "./card"
|
||||
import CardInfo from "./info"
|
||||
import Highlights from "./highlights"
|
||||
import { SourceTextDirection } from "../../scripts/models/source"
|
||||
|
||||
const className = (props: Card.Props) => {
|
||||
let cn = ["card", "default-card"]
|
||||
if (props.item.snippet && props.item.thumb) cn.push("transform")
|
||||
if (props.item.hidden) cn.push("hidden")
|
||||
if (props.source.textDir === SourceTextDirection.RTL) cn.push("rtl")
|
||||
return cn.join(" ")
|
||||
}
|
||||
|
||||
@ -25,19 +27,10 @@ const DefaultCard: React.FunctionComponent<Card.Props> = props => (
|
||||
) : null}
|
||||
<CardInfo source={props.source} item={props.item} />
|
||||
<h3 className="title">
|
||||
<Highlights
|
||||
text={props.item.title}
|
||||
filter={props.filter}
|
||||
title
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
<Highlights text={props.item.title} filter={props.filter} title />
|
||||
</h3>
|
||||
<p className={"snippet" + (props.item.thumb ? "" : " show")}>
|
||||
<Highlights
|
||||
text={props.item.snippet}
|
||||
filter={props.filter}
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
<Highlights text={props.item.snippet} filter={props.filter} />
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
|
@ -7,7 +7,6 @@ type HighlightsProps = {
|
||||
text: string
|
||||
filter: FeedFilter
|
||||
title?: boolean
|
||||
dir?: SourceTextDirection
|
||||
}
|
||||
|
||||
const Highlights: React.FunctionComponent<HighlightsProps> = props => {
|
||||
@ -59,22 +58,10 @@ const Highlights: React.FunctionComponent<HighlightsProps> = props => {
|
||||
}
|
||||
}
|
||||
|
||||
const testStyle = {
|
||||
direction: "inherit",
|
||||
} as React.CSSProperties
|
||||
if (props.dir === SourceTextDirection.RTL) {
|
||||
testStyle.direction = "rtl"
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{spans.map(([text, flag]) =>
|
||||
flag ? (
|
||||
<div className="h" style={testStyle}>
|
||||
{text}
|
||||
</div>
|
||||
) : (
|
||||
<div style={testStyle}>{text}</div>
|
||||
)
|
||||
flag ? <span className="h">{text}</span> : text
|
||||
)}
|
||||
</>
|
||||
)
|
||||
|
@ -3,6 +3,7 @@ import { Card } from "./card"
|
||||
import CardInfo from "./info"
|
||||
import Highlights from "./highlights"
|
||||
import { ViewConfigs } from "../../schema-types"
|
||||
import { SourceTextDirection } from "../../scripts/models/source"
|
||||
|
||||
const className = (props: Card.Props) => {
|
||||
let cn = ["card", "list-card"]
|
||||
@ -10,6 +11,7 @@ const className = (props: Card.Props) => {
|
||||
if (props.selected) cn.push("selected")
|
||||
if (props.viewConfigs & ViewConfigs.FadeRead && props.item.hasRead)
|
||||
cn.push("read")
|
||||
if (props.source.textDir === SourceTextDirection.RTL) cn.push("rtl")
|
||||
return cn.join(" ")
|
||||
}
|
||||
|
||||
@ -31,7 +33,6 @@ const ListCard: React.FunctionComponent<Card.Props> = props => (
|
||||
text={props.item.title}
|
||||
filter={props.filter}
|
||||
title
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</h3>
|
||||
{Boolean(props.viewConfigs & ViewConfigs.ShowSnippet) && (
|
||||
@ -39,7 +40,6 @@ const ListCard: React.FunctionComponent<Card.Props> = props => (
|
||||
<Highlights
|
||||
text={props.item.snippet}
|
||||
filter={props.filter}
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</p>
|
||||
)}
|
||||
|
@ -2,11 +2,13 @@ import * as React from "react"
|
||||
import { Card } from "./card"
|
||||
import CardInfo from "./info"
|
||||
import Highlights from "./highlights"
|
||||
import { SourceTextDirection } from "../../scripts/models/source"
|
||||
|
||||
const className = (props: Card.Props) => {
|
||||
let cn = ["card", "magazine-card"]
|
||||
if (props.item.hasRead) cn.push("read")
|
||||
if (props.item.hidden) cn.push("hidden")
|
||||
if (props.source.textDir === SourceTextDirection.RTL) cn.push("rtl")
|
||||
return cn.join(" ")
|
||||
}
|
||||
|
||||
@ -28,14 +30,12 @@ const MagazineCard: React.FunctionComponent<Card.Props> = props => (
|
||||
text={props.item.title}
|
||||
filter={props.filter}
|
||||
title
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</h3>
|
||||
<p className="snippet">
|
||||
<Highlights
|
||||
text={props.item.snippet}
|
||||
filter={props.filter}
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -49,6 +49,7 @@ export class Menu extends React.Component<MenuProps> {
|
||||
intl.get("allArticles") +
|
||||
this.countOverflow(
|
||||
Object.values(this.props.sources)
|
||||
.filter(s => !s.hidden)
|
||||
.map(s => s.unreadCount)
|
||||
.reduce((a, b) => a + b, 0)
|
||||
),
|
||||
|
@ -16,6 +16,7 @@ import {
|
||||
Dropdown,
|
||||
MessageBar,
|
||||
MessageBarType,
|
||||
Toggle,
|
||||
} from "@fluentui/react"
|
||||
import {
|
||||
SourceState,
|
||||
@ -42,6 +43,7 @@ type SourcesTabProps = {
|
||||
deleteSources: (sources: RSSSource[]) => void
|
||||
importOPML: () => void
|
||||
exportOPML: () => void
|
||||
toggleSourceHidden: (source: RSSSource) => void
|
||||
}
|
||||
|
||||
type SourcesTabState = {
|
||||
@ -217,6 +219,16 @@ class SourcesTab extends React.Component<SourcesTabProps, SourcesTabState> {
|
||||
})
|
||||
}
|
||||
|
||||
onToggleHidden = () => {
|
||||
this.props.toggleSourceHidden(this.state.selectedSource)
|
||||
this.setState({
|
||||
selectedSource: {
|
||||
...this.state.selectedSource,
|
||||
hidden: !this.state.selectedSource.hidden,
|
||||
} as RSSSource,
|
||||
})
|
||||
}
|
||||
|
||||
render = () => (
|
||||
<div className="tab-body">
|
||||
{this.props.serviceOn && (
|
||||
@ -409,6 +421,17 @@ class SourcesTab extends React.Component<SourcesTabProps, SourcesTabState> {
|
||||
)}
|
||||
onChange={this.onOpenTargetChange}
|
||||
/>
|
||||
<Stack horizontal verticalAlign="baseline">
|
||||
<Stack.Item grow>
|
||||
<Label>{intl.get("sources.hidden")}</Label>
|
||||
</Stack.Item>
|
||||
<Stack.Item>
|
||||
<Toggle
|
||||
checked={this.state.selectedSource.hidden}
|
||||
onChange={this.onToggleHidden}
|
||||
/>
|
||||
</Stack.Item>
|
||||
</Stack>
|
||||
{!this.state.selectedSource.serviceRef && (
|
||||
<Stack horizontal>
|
||||
<Stack.Item>
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
deleteSource,
|
||||
SourceOpenTarget,
|
||||
deleteSources,
|
||||
toggleSourceHidden,
|
||||
} from "../../scripts/models/source"
|
||||
import { importOPML, exportOPML } from "../../scripts/models/group"
|
||||
import { AppDispatch, validateFavicon } from "../../scripts/utils"
|
||||
@ -67,6 +68,8 @@ const mapDispatchToProps = (dispatch: AppDispatch) => {
|
||||
dispatch(deleteSources(sources)),
|
||||
importOPML: () => dispatch(importOPML()),
|
||||
exportOPML: () => dispatch(exportOPML()),
|
||||
toggleSourceHidden: (source: RSSSource) =>
|
||||
dispatch(toggleSourceHidden(source)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import lf from "lovefield"
|
||||
import { RSSSource } from "./models/source"
|
||||
import { RSSItem } from "./models/item"
|
||||
|
||||
const sdbSchema = lf.schema.create("sourcesDB", 2)
|
||||
const sdbSchema = lf.schema.create("sourcesDB", 3)
|
||||
sdbSchema
|
||||
.createTable("sources")
|
||||
.addColumn("sid", lf.Type.INTEGER)
|
||||
@ -18,6 +18,7 @@ sdbSchema
|
||||
.addColumn("fetchFrequency", lf.Type.NUMBER)
|
||||
.addColumn("rules", lf.Type.OBJECT)
|
||||
.addColumn("textDir", lf.Type.NUMBER)
|
||||
.addColumn("hidden", lf.Type.BOOLEAN)
|
||||
.addNullable(["iconurl", "serviceRef", "rules"])
|
||||
.addIndex("idxURL", ["url"], true)
|
||||
|
||||
@ -54,6 +55,9 @@ async function onUpgradeSourceDB(rawDb: lf.raw.BackStore) {
|
||||
if (version < 2) {
|
||||
await rawDb.addTableColumn("sources", "textDir", 0)
|
||||
}
|
||||
if (version < 3) {
|
||||
await rawDb.addTableColumn("sources", "hidden", false)
|
||||
}
|
||||
}
|
||||
|
||||
export async function init() {
|
||||
@ -99,6 +103,7 @@ async function migrateNeDB() {
|
||||
delete doc._id
|
||||
if (!doc.fetchFrequency) doc.fetchFrequency = 0
|
||||
doc.textDir = 0
|
||||
doc.hidden = false
|
||||
return sources.createRow(doc)
|
||||
})
|
||||
const iRows = itemDocs.map(doc => {
|
||||
|
@ -7,7 +7,7 @@
|
||||
"openExternal": "Extern öffnen",
|
||||
"emptyName": "Dieses Feld darf nicht leer sein.",
|
||||
"emptyField": "Dieses Feld darf nicht leer sein.",
|
||||
"edit": "Berarbeiten",
|
||||
"edit": "Bearbeiten",
|
||||
"delete": "Entfernen",
|
||||
"followSystem": "Systemstandard verwenden",
|
||||
"more": "Mehr",
|
||||
@ -62,7 +62,7 @@
|
||||
"markBelow": "Darunter als gelesen markieren",
|
||||
"star": "Favorisieren",
|
||||
"unstar": "Favorit entfernen",
|
||||
"fontSize": "Schritgröße",
|
||||
"fontSize": "Schriftgröße",
|
||||
"loadWebpage": "Internetseite laden",
|
||||
"loadFull": "Kompletten Inhalt laden",
|
||||
"notify": "Benachrichtigen, wenn im Hintergrund geladen",
|
||||
@ -201,7 +201,7 @@
|
||||
"fetchLimitNum": "{count} Artikel",
|
||||
"importGroups": "Gruppen importieren",
|
||||
"failure": "Fehler beim Verbinden zum Server",
|
||||
"failureHint": "Bite überprüfe die Server-Konfiguration oder deinen Netzwerk-Status.",
|
||||
"failureHint": "Bitte überprüfe die Server-Konfiguration oder deinen Netzwerk-Status.",
|
||||
"fetchUnlimited": "Unbegrenzt (nicht empfohlen)",
|
||||
"exportToLite": "Für Fluent Reader Lite exportieren"
|
||||
},
|
||||
|
@ -149,7 +149,8 @@
|
||||
"badUrl": "Invalid URL",
|
||||
"deleteWarning": "The source and all saved articles will be removed.",
|
||||
"selected": "Selected source",
|
||||
"selectedMulti": "Selected multiple sources"
|
||||
"selectedMulti": "Selected multiple sources",
|
||||
"hidden": "Hide in \"all articles\""
|
||||
},
|
||||
"groups": {
|
||||
"exist": "This group already exists.",
|
||||
|
@ -147,7 +147,8 @@
|
||||
"badUrl": "请正确输入URL",
|
||||
"deleteWarning": "这将移除订阅源与所有已保存的文章",
|
||||
"selected": "选中订阅源",
|
||||
"selectedMulti": "选中多个订阅源"
|
||||
"selectedMulti": "选中多个订阅源",
|
||||
"hidden": "从“全部文章”中隐藏"
|
||||
},
|
||||
"groups": {
|
||||
"exist": "该分组已存在",
|
||||
|
@ -147,7 +147,8 @@
|
||||
"badUrl": "請正確輸入URL",
|
||||
"deleteWarning": "這將移除訂閱源與所有已儲存的文章",
|
||||
"selected": "選中訂閱源",
|
||||
"selectedMulti": "選中多個訂閱源"
|
||||
"selectedMulti": "選中多個訂閱源",
|
||||
"hidden": "從“全部文章”中隱藏"
|
||||
},
|
||||
"groups": {
|
||||
"exist": "該分組已存在",
|
||||
|
@ -5,6 +5,8 @@ import {
|
||||
INIT_SOURCES,
|
||||
ADD_SOURCE,
|
||||
DELETE_SOURCE,
|
||||
UNHIDE_SOURCE,
|
||||
HIDE_SOURCE,
|
||||
} from "./source"
|
||||
import {
|
||||
ItemActionTypes,
|
||||
@ -316,13 +318,16 @@ export function feedReducer(
|
||||
...state,
|
||||
[ALL]: new RSSFeed(
|
||||
ALL,
|
||||
Object.values(action.sources).map(s => s.sid)
|
||||
Object.values(action.sources)
|
||||
.filter(s => !s.hidden)
|
||||
.map(s => s.sid)
|
||||
),
|
||||
}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
case ADD_SOURCE:
|
||||
case UNHIDE_SOURCE:
|
||||
switch (action.status) {
|
||||
case ActionStatus.Success:
|
||||
return {
|
||||
@ -336,7 +341,8 @@ export function feedReducer(
|
||||
default:
|
||||
return state
|
||||
}
|
||||
case DELETE_SOURCE: {
|
||||
case DELETE_SOURCE:
|
||||
case HIDE_SOURCE: {
|
||||
let nextState = {}
|
||||
for (let [id, feed] of Object.entries(state)) {
|
||||
nextState[id] = new RSSFeed(
|
||||
|
@ -41,6 +41,7 @@ export class RSSSource {
|
||||
fetchFrequency: number // in minutes
|
||||
rules?: SourceRule[]
|
||||
textDir: SourceTextDirection
|
||||
hidden: boolean
|
||||
|
||||
constructor(url: string, name: string = null) {
|
||||
this.url = url
|
||||
@ -49,6 +50,7 @@ export class RSSSource {
|
||||
this.lastFetched = new Date()
|
||||
this.fetchFrequency = 0
|
||||
this.textDir = SourceTextDirection.LTR
|
||||
this.hidden = false
|
||||
}
|
||||
|
||||
static async fetchMetaData(source: RSSSource) {
|
||||
@ -120,6 +122,8 @@ export const ADD_SOURCE = "ADD_SOURCE"
|
||||
export const UPDATE_SOURCE = "UPDATE_SOURCE"
|
||||
export const UPDATE_UNREAD_COUNTS = "UPDATE_UNREAD_COUNTS"
|
||||
export const DELETE_SOURCE = "DELETE_SOURCE"
|
||||
export const HIDE_SOURCE = "HIDE_SOURCE"
|
||||
export const UNHIDE_SOURCE = "UNHIDE_SOURCE"
|
||||
|
||||
interface InitSourcesAction {
|
||||
type: typeof INIT_SOURCES
|
||||
@ -151,12 +155,19 @@ interface DeleteSourceAction {
|
||||
source: RSSSource
|
||||
}
|
||||
|
||||
interface ToggleSourceHiddenAction {
|
||||
type: typeof HIDE_SOURCE | typeof UNHIDE_SOURCE
|
||||
status: ActionStatus
|
||||
source: RSSSource
|
||||
}
|
||||
|
||||
export type SourceActionTypes =
|
||||
| InitSourcesAction
|
||||
| AddSourceAction
|
||||
| UpdateSourceAction
|
||||
| UpdateUnreadCountsAction
|
||||
| DeleteSourceAction
|
||||
| ToggleSourceHiddenAction
|
||||
|
||||
export function initSourcesRequest(): SourceActionTypes {
|
||||
return {
|
||||
@ -382,6 +393,19 @@ export function deleteSources(sources: RSSSource[]): AppThunk<Promise<void>> {
|
||||
}
|
||||
}
|
||||
|
||||
export function toggleSourceHidden(source: RSSSource): AppThunk<Promise<void>> {
|
||||
return async (dispatch, getState) => {
|
||||
const sourceCopy: RSSSource = { ...getState().sources[source.sid] }
|
||||
sourceCopy.hidden = !sourceCopy.hidden
|
||||
dispatch({
|
||||
type: sourceCopy.hidden ? HIDE_SOURCE : UNHIDE_SOURCE,
|
||||
status: ActionStatus.Success,
|
||||
source: sourceCopy,
|
||||
})
|
||||
await dispatch(updateSource(sourceCopy))
|
||||
}
|
||||
}
|
||||
|
||||
export function updateFavicon(
|
||||
sids?: number[],
|
||||
force = false
|
||||
|
@ -146,6 +146,7 @@ export async function importAll() {
|
||||
const sRows = configs.lovefield.sources.map(s => {
|
||||
s.lastFetched = new Date(s.lastFetched)
|
||||
if (!s.textDir) s.textDir = SourceTextDirection.LTR
|
||||
if (!s.hidden) s.hidden = false
|
||||
return db.sources.createRow(s)
|
||||
})
|
||||
const iRows = configs.lovefield.items.map(i => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user