mirror of
https://github.com/yang991178/fluent-reader.git
synced 2026-09-18 13:41:51 +00:00
article view context isolation
This commit is contained in:
Vendored
+2
-2
@@ -3,14 +3,14 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; script-src-elem 'sha256-34JRfFnY5YiFDB1MABAIxq6OfvlgM/Ba2el4MdA0WoM='; img-src http://* https://*; style-src 'self' 'unsafe-inline'; frame-src http://* https://*; media-src http://* https://*">
|
||||
content="default-src 'none'; script-src-elem 'sha256-XUiRvcvPhKzBU50B7nIFBLySVn2CJ3cNFgqtfeiRcTA='; img-src http://* https://*; style-src 'self' 'unsafe-inline'; frame-src http://* https://*; media-src http://* https://*">
|
||||
<title>Article</title>
|
||||
<link rel="stylesheet" href="scroll.css" />
|
||||
<link rel="stylesheet" href="article.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="main"></div>
|
||||
<script integrity="sha256-34JRfFnY5YiFDB1MABAIxq6OfvlgM/Ba2el4MdA0WoM=" src="article.js"></script>
|
||||
<script integrity="sha256-XUiRvcvPhKzBU50B7nIFBLySVn2CJ3cNFgqtfeiRcTA=" src="article.js"></script>
|
||||
<!-- Run "cat article.js | openssl dgst -sha256 -binary | openssl enc -base64 -A" for hash -->
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+9
-2
@@ -19,9 +19,16 @@ let main = document.getElementById("main")
|
||||
main.innerHTML = dom.body.innerHTML
|
||||
document.addEventListener("click", event => {
|
||||
event.preventDefault()
|
||||
if (event.target.href) post("request-navigation", event.target.href)
|
||||
let target = event.target
|
||||
while (target.nodeName !== "#document") {
|
||||
if (target.href) {
|
||||
window.renderer.requestNavigation(target.href)
|
||||
break
|
||||
}
|
||||
target = target.parentNode
|
||||
}
|
||||
})
|
||||
document.addEventListener("contextmenu", event => {
|
||||
let text = document.getSelection().toString()
|
||||
if (text) post("context-menu", [event.clientX, event.clientY], text)
|
||||
if (text) window.renderer.contextMenu([event.clientX, event.clientY], text)
|
||||
})
|
||||
Vendored
+10
-1
@@ -1 +1,10 @@
|
||||
global.post = require("electron").ipcRenderer.sendToHost
|
||||
const { contextBridge, ipcRenderer } = require("electron")
|
||||
|
||||
contextBridge.exposeInMainWorld("renderer",{
|
||||
requestNavigation: (href) => {
|
||||
ipcRenderer.sendToHost("request-navigation", href)
|
||||
},
|
||||
contextMenu: (pos, text) => {
|
||||
ipcRenderer.sendToHost("context-menu", pos, text)
|
||||
}
|
||||
})
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { renderToString } from "react-dom/server"
|
||||
import { RSSItem } from "../scripts/models/item"
|
||||
import { openExternal } from "../scripts/utils"
|
||||
@@ -230,6 +230,7 @@ class Article extends React.Component<ArticleProps, ArticleState> {
|
||||
key={this.props.item._id + (this.state.loadWebpage ? "_" : "")}
|
||||
src={this.state.loadWebpage ? this.props.item.link : this.articleView()}
|
||||
preload={this.state.loadWebpage ? null : "article/preload.js"}
|
||||
webpreferences="contextIsolation,sandbox,disableDialogs,autoplayPolicy=document-user-activation-required"
|
||||
partition="sandbox" />
|
||||
</FocusZone>
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { clipboard } from "electron"
|
||||
import { openExternal, cutText, googleSearch } from "../scripts/utils"
|
||||
import { ContextualMenu, IContextualMenuItem, ContextualMenuItemType, DirectionalHint } from "office-ui-fabric-react/lib/ContextualMenu"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { FeedProps } from "./feed"
|
||||
import DefaultCard from "../cards/default-card"
|
||||
import { PrimaryButton, FocusZone } from 'office-ui-fabric-react';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { FeedProps } from "./feed"
|
||||
import { DefaultButton, FocusZone, FocusZoneDirection } from 'office-ui-fabric-react';
|
||||
import ListCard from "../cards/list-card";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { Callout, ActivityItem, Icon, DirectionalHint } from "@fluentui/react"
|
||||
import { AppLog, AppLogType } from "../scripts/models/app"
|
||||
import Time from "./utils/time"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { Icon } from "@fluentui/react/lib/Icon"
|
||||
import { Nav, INavLink, INavLinkGroup } from "office-ui-fabric-react/lib/Nav"
|
||||
import { SourceGroup } from "../scripts/models/group"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { remote } from "electron"
|
||||
import { Icon } from "@fluentui/react/lib/Icon"
|
||||
import { AppState } from "../scripts/models/app"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { Icon } from "@fluentui/react/lib/Icon"
|
||||
import { AnimationClassNames } from "@fluentui/react/lib/Styling"
|
||||
import AboutTab from "./settings/about"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { Stack, Link } from "@fluentui/react"
|
||||
import { openExternal } from "../../scripts/utils"
|
||||
import { remote } from "electron"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { urlTest, byteToMB, calculateItemSize } from "../../scripts/utils"
|
||||
import { getProxy, getProxyStatus, toggleProxyStatus, setProxy, getThemeSettings, setThemeSettings, ThemeSettings, getLocaleSettings, exportAll } from "../../scripts/settings"
|
||||
import { Stack, Label, Toggle, TextField, DefaultButton, ChoiceGroup, IChoiceGroupOption, loadTheme, Dropdown, IDropdownOption, PrimaryButton } from "@fluentui/react"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { SourceGroup } from "../../scripts/models/group"
|
||||
import { SourceState, RSSSource } from "../../scripts/models/source"
|
||||
import { IColumn, Selection, SelectionMode, DetailsList, Label, Stack,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { SourceState, RSSSource } from "../../scripts/models/source"
|
||||
import { Stack, Label, Dropdown, IDropdownOption, TextField, PrimaryButton, Icon, DropdownMenuItemType,
|
||||
DefaultButton, DetailsList, IColumn, CommandBar, ICommandBarItemProps, Selection, SelectionMode, MarqueeSelection, IDragDropEvents } from "@fluentui/react"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { Label, DefaultButton, TextField, Stack, PrimaryButton, DetailsList,
|
||||
IColumn, SelectionMode, Selection, IChoiceGroupOption, ChoiceGroup, IDropdownOption, Dropdown } from "@fluentui/react"
|
||||
import { SourceState, RSSSource, SourceOpenTarget } from "../../scripts/models/source"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { connect } from "react-redux"
|
||||
import { RootState } from "../../scripts/reducer"
|
||||
import { SearchBox, ISearchBox, Async } from "@fluentui/react"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { PrimaryButton } from "@fluentui/react";
|
||||
|
||||
class DangerButton extends PrimaryButton {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
|
||||
interface TimeProps {
|
||||
date: Date
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { remote } from "electron"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { connect } from "react-redux"
|
||||
import { createSelector } from "reselect"
|
||||
import { RootState } from "../scripts/reducer"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { connect } from "react-redux"
|
||||
import { setLocaleSettings, importAll } from "../../scripts/settings"
|
||||
import { initIntl, saveSettings } from "../../scripts/models/app"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { remote } from "electron"
|
||||
import { connect } from "react-redux"
|
||||
import { createSelector } from "reselect"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { RSSSource, INIT_SOURCES, SourceActionTypes, ADD_SOURCE, UPDATE_SOURCE, DELETE_SOURCE, initSources } from "./source"
|
||||
import { RSSItem, ItemActionTypes, FETCH_ITEMS, fetchItems } from "./item"
|
||||
import { ActionStatus, AppThunk, getWindowBreakpoint } from "../utils"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import fs = require("fs")
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { SourceActionTypes, ADD_SOURCE, DELETE_SOURCE, addSource, RSSSource } from "./source"
|
||||
|
||||
import { ActionStatus, AppThunk, domParser, AppDispatch } from "../utils"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as db from "../db"
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import { domParser, htmlDecode, ActionStatus, AppThunk, openExternal } from "../utils"
|
||||
import { RSSSource } from "./source"
|
||||
import { FeedActionTypes, INIT_FEED, LOAD_MORE } from "./feed"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Parser = require("@yang991178/rss-parser")
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
import * as db from "../db"
|
||||
import { fetchFavicon, ActionStatus, AppThunk, parseRSS } from "../utils"
|
||||
import { RSSItem, insertItems, ItemActionTypes, FETCH_ITEMS, MARK_READ, MARK_UNREAD, MARK_ALL_READ } from "./item"
|
||||
|
||||
@@ -5,7 +5,7 @@ import locales from "./i18n/_locales"
|
||||
import Store = require("electron-store")
|
||||
import { schemaTypes } from "./config-schema"
|
||||
import fs = require("fs")
|
||||
import intl = require("react-intl-universal")
|
||||
import intl from "react-intl-universal"
|
||||
|
||||
export const store = new Store<schemaTypes>()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user