mirror of
https://github.com/yang991178/fluent-reader.git
synced 2025-04-03 21:21:17 +02:00
beta release build 0.8.0
This commit is contained in:
parent
1d8863922f
commit
59b28ec7c6
@ -71,7 +71,7 @@ npm run package-win
|
|||||||
- [React](https://github.com/facebook/react)
|
- [React](https://github.com/facebook/react)
|
||||||
- [Redux](https://github.com/reduxjs/redux)
|
- [Redux](https://github.com/reduxjs/redux)
|
||||||
- [Fluent UI](https://github.com/microsoft/fluentui)
|
- [Fluent UI](https://github.com/microsoft/fluentui)
|
||||||
- [NeDB](https://github.com/louischatriot/nedb)
|
- [Lovefield](https://github.com/google/lovefield)
|
||||||
- [Mercury Parser](https://github.com/postlight/mercury-parser)
|
- [Mercury Parser](https://github.com/postlight/mercury-parser)
|
||||||
|
|
||||||
### License
|
### License
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "fluent-reader",
|
"name": "fluent-reader",
|
||||||
"version": "0.7.4",
|
"version": "0.8.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "fluent-reader",
|
"name": "fluent-reader",
|
||||||
"version": "0.7.4",
|
"version": "0.8.0",
|
||||||
"description": "Modern desktop RSS reader",
|
"description": "Modern desktop RSS reader",
|
||||||
"main": "./dist/electron.js",
|
"main": "./dist/electron.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -16,6 +16,7 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "Haoyuan Liu",
|
"author": "Haoyuan Liu",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
|
"repository": "github:yang991178/fluent-reader",
|
||||||
"build": {
|
"build": {
|
||||||
"appId": "me.hyliu.fluentreader",
|
"appId": "me.hyliu.fluentreader",
|
||||||
"productName": "Fluent Reader",
|
"productName": "Fluent Reader",
|
||||||
|
@ -64,15 +64,13 @@ class Nav extends React.Component<NavProps, NavState> {
|
|||||||
this.props.markAllRead()
|
this.props.markAllRead()
|
||||||
break
|
break
|
||||||
case "F7":
|
case "F7":
|
||||||
if (!this.props.state.menu || getWindowBreakpoint())
|
if (!this.props.itemShown) this.props.logs()
|
||||||
this.props.logs()
|
|
||||||
break
|
break
|
||||||
case "F8":
|
case "F8":
|
||||||
if (!this.props.state.menu || getWindowBreakpoint())
|
if (!this.props.itemShown) this.props.views()
|
||||||
this.props.views()
|
|
||||||
break
|
break
|
||||||
case "F9":
|
case "F9":
|
||||||
this.props.settings()
|
if (!this.props.itemShown) this.props.settings()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ const mapDispatchToProps = (dispatch: AppDispatch) => {
|
|||||||
toggleStarred: (item: RSSItem) => dispatch(toggleStarred(item)),
|
toggleStarred: (item: RSSItem) => dispatch(toggleStarred(item)),
|
||||||
toggleHidden: (item: RSSItem) => {
|
toggleHidden: (item: RSSItem) => {
|
||||||
if (!item.hidden) dispatch(dismissItem())
|
if (!item.hidden) dispatch(dismissItem())
|
||||||
|
if (!item.hasRead && !item.hidden) dispatch(markRead(item))
|
||||||
dispatch(toggleHidden(item))
|
dispatch(toggleHidden(item))
|
||||||
},
|
},
|
||||||
textMenu: (position: [number, number], text: string, url: string) => dispatch(openTextMenu(position, text, url)),
|
textMenu: (position: [number, number], text: string, url: string) => dispatch(openTextMenu(position, text, url)),
|
||||||
|
@ -7,9 +7,13 @@ export default function performUpdate(store: Store<SchemaTypes>) {
|
|||||||
let useNeDB = store.get("useNeDB", undefined)
|
let useNeDB = store.get("useNeDB", undefined)
|
||||||
let currentVersion = app.getVersion()
|
let currentVersion = app.getVersion()
|
||||||
|
|
||||||
if (useNeDB === undefined && version !== null) {
|
if (useNeDB === undefined) {
|
||||||
const revs = version.split(".").map(s => parseInt(s))
|
if (version !== null) {
|
||||||
store.set("useNeDB", (revs[0] === 0 && revs[1] < 8) || !app.isPackaged)
|
const revs = version.split(".").map(s => parseInt(s))
|
||||||
|
store.set("useNeDB", (revs[0] === 0 && revs[1] < 8) || !app.isPackaged)
|
||||||
|
} else {
|
||||||
|
store.set("useNeDB", false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (version != currentVersion) {
|
if (version != currentVersion) {
|
||||||
store.set("version", currentVersion)
|
store.set("version", currentVersion)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import intl from "react-intl-universal"
|
||||||
import Datastore from "nedb"
|
import Datastore from "nedb"
|
||||||
import lf from "lovefield"
|
import lf from "lovefield"
|
||||||
import { RSSSource } from "./models/source"
|
import { RSSSource } from "./models/source"
|
||||||
@ -49,6 +50,12 @@ export async function init() {
|
|||||||
itemsDB = await idbSchema.connect()
|
itemsDB = await idbSchema.connect()
|
||||||
items = itemsDB.getSchema().table("items")
|
items = itemsDB.getSchema().table("items")
|
||||||
if (window.settings.getNeDBStatus()) {
|
if (window.settings.getNeDBStatus()) {
|
||||||
|
await migrateNeDB()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function migrateNeDB() {
|
||||||
|
try {
|
||||||
const sdb = new Datastore<RSSSource>({
|
const sdb = new Datastore<RSSSource>({
|
||||||
filename: "sources",
|
filename: "sources",
|
||||||
autoload: true,
|
autoload: true,
|
||||||
@ -82,6 +89,9 @@ export async function init() {
|
|||||||
})
|
})
|
||||||
const iRows = itemDocs.map(doc => {
|
const iRows = itemDocs.map(doc => {
|
||||||
if (doc.serviceRef !== undefined) doc.serviceRef = String(doc.serviceRef)
|
if (doc.serviceRef !== undefined) doc.serviceRef = String(doc.serviceRef)
|
||||||
|
if (!doc.title) doc.title = intl.get("article.untitled")
|
||||||
|
if (!doc.content) doc.content = ""
|
||||||
|
if (!doc.snippet) doc.snippet = ""
|
||||||
delete doc._id
|
delete doc._id
|
||||||
doc.starred = Boolean(doc.starred)
|
doc.starred = Boolean(doc.starred)
|
||||||
doc.hidden = Boolean(doc.hidden)
|
doc.hidden = Boolean(doc.hidden)
|
||||||
@ -95,5 +105,8 @@ export async function init() {
|
|||||||
window.settings.setNeDBStatus(false)
|
window.settings.setNeDBStatus(false)
|
||||||
sdb.remove({}, { multi: true }, () => { sdb.persistence.compactDatafile() })
|
sdb.remove({}, { multi: true }, () => { sdb.persistence.compactDatafile() })
|
||||||
idb.remove({}, { multi: true }, () => { idb.persistence.compactDatafile() })
|
idb.remove({}, { multi: true }, () => { idb.persistence.compactDatafile() })
|
||||||
|
} catch (err) {
|
||||||
|
window.utils.showErrorBox("An error has occured during update. Please report this error on GitHub.", String(err))
|
||||||
|
window.utils.closeWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,11 +303,7 @@ const toggleStarredDone = (item: RSSItem): ItemActionTypes => ({
|
|||||||
|
|
||||||
export function toggleStarred(item: RSSItem): AppThunk {
|
export function toggleStarred(item: RSSItem): AppThunk {
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
if (item.starred) {
|
db.itemsDB.update(db.items).where(db.items._id.eq(item._id)).set(db.items.starred, !item.starred).exec()
|
||||||
db.itemsDB.update(db.items).where(db.items._id.eq(item._id)).set(db.items.starred, false).exec()
|
|
||||||
} else {
|
|
||||||
db.itemsDB.update(db.items).where(db.items._id.eq(item._id)).set(db.items.starred, true).exec()
|
|
||||||
}
|
|
||||||
dispatch(toggleStarredDone(item))
|
dispatch(toggleStarredDone(item))
|
||||||
if (item.serviceRef) {
|
if (item.serviceRef) {
|
||||||
const hooks = dispatch(getServiceHooks())
|
const hooks = dispatch(getServiceHooks())
|
||||||
@ -324,11 +320,7 @@ const toggleHiddenDone = (item: RSSItem): ItemActionTypes => ({
|
|||||||
|
|
||||||
export function toggleHidden(item: RSSItem): AppThunk {
|
export function toggleHidden(item: RSSItem): AppThunk {
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
if (item.hidden) {
|
db.itemsDB.update(db.items).where(db.items._id.eq(item._id)).set(db.items.hidden, !item.hidden).exec()
|
||||||
db.itemsDB.update(db.items).where(db.items._id.eq(item._id)).set(db.items.hidden, false).exec()
|
|
||||||
} else {
|
|
||||||
db.itemsDB.update(db.items).where(db.items._id.eq(item._id)).set(db.items.hidden, true).exec()
|
|
||||||
}
|
|
||||||
dispatch(toggleHiddenDone(item))
|
dispatch(toggleHiddenDone(item))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,7 +340,7 @@ export function itemShortcuts(item: RSSItem, e: KeyboardEvent): AppThunk {
|
|||||||
dispatch(toggleStarred(item))
|
dispatch(toggleStarred(item))
|
||||||
break
|
break
|
||||||
case "h": case "H":
|
case "h": case "H":
|
||||||
if (!item.hasRead) dispatch(markRead(item))
|
if (!item.hasRead && !item.hidden) dispatch(markRead(item))
|
||||||
dispatch(toggleHidden(item))
|
dispatch(toggleHidden(item))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,8 @@ export const feedbinServiceHooks: ServiceHooks = {
|
|||||||
if (date) {
|
if (date) {
|
||||||
predicates.push(before ? db.items.date.lte(date) : db.items.date.gte(date))
|
predicates.push(before ? db.items.date.lte(date) : db.items.date.gte(date))
|
||||||
}
|
}
|
||||||
const rows = await db.itemsDB.select(db.items.serviceRef).where(lf.op.and.apply(null, predicates)).exec()
|
const query = lf.op.and.apply(null, predicates)
|
||||||
|
const rows = await db.itemsDB.select(db.items.serviceRef).from(db.items).where(query).exec()
|
||||||
const refs = rows.map(row => parseInt(row["serviceRef"]))
|
const refs = rows.map(row => parseInt(row["serviceRef"]))
|
||||||
markItems(configs, "unread", "DELETE", refs)
|
markItems(configs, "unread", "DELETE", refs)
|
||||||
},
|
},
|
||||||
|
@ -223,8 +223,9 @@ export function insertSource(source: RSSSource): AppThunk<Promise<RSSSource>> {
|
|||||||
try {
|
try {
|
||||||
const inserted = (await db.sourcesDB.insert().into(db.sources).values([row]).exec()) as RSSSource[]
|
const inserted = (await db.sourcesDB.insert().into(db.sources).values([row]).exec()) as RSSSource[]
|
||||||
resolve(inserted[0])
|
resolve(inserted[0])
|
||||||
} catch {
|
} catch (err) {
|
||||||
reject(intl.get("sources.exist"))
|
if (err.code === 201) reject(intl.get("sources.exist"))
|
||||||
|
else reject(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user