mirror of
https://github.com/yang991178/fluent-reader.git
synced 2025-04-23 22:57:25 +02:00
enable code sandboxing
This commit is contained in:
parent
114d1802a3
commit
aeb1b95975
4
dist/article/article.html
vendored
4
dist/article/article.html
vendored
@ -3,13 +3,13 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="Content-Security-Policy"
|
<meta http-equiv="Content-Security-Policy"
|
||||||
content="default-src 'none'; script-src-elem 'sha256-Y47O8EyR7IULmMXvvGsrM43xajwkPmTKvC8AhLDvg/o='; 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-HLvh6tC4kZKt81b6Yi9wjdyXvuwO6InxwRG96ZZjHrw='; img-src http://* https://*; style-src 'self' 'unsafe-inline'; frame-src http://* https://*; media-src http://* https://*">
|
||||||
<title>Article</title>
|
<title>Article</title>
|
||||||
<link rel="stylesheet" href="article.css" />
|
<link rel="stylesheet" href="article.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="main"></div>
|
<div id="main"></div>
|
||||||
<script integrity="sha256-Y47O8EyR7IULmMXvvGsrM43xajwkPmTKvC8AhLDvg/o=" src="article.js"></script>
|
<script integrity="sha256-HLvh6tC4kZKt81b6Yi9wjdyXvuwO6InxwRG96ZZjHrw=" src="article.js"></script>
|
||||||
<!-- Run "cat article.js | openssl dgst -sha256 -binary | openssl enc -base64 -A" for hash -->
|
<!-- Run "cat article.js | openssl dgst -sha256 -binary | openssl enc -base64 -A" for hash -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
2
dist/article/article.js
vendored
2
dist/article/article.js
vendored
@ -3,7 +3,7 @@ function get(name) {
|
|||||||
return decodeURIComponent(name[1]);
|
return decodeURIComponent(name[1]);
|
||||||
}
|
}
|
||||||
document.documentElement.style.fontSize = get("s") + "px"
|
document.documentElement.style.fontSize = get("s") + "px"
|
||||||
let html = decodeURIComponent(window.atob(get("h")))
|
let html = get("h")
|
||||||
let domParser = new DOMParser()
|
let domParser = new DOMParser()
|
||||||
let dom = domParser.parseFromString(html, "text/html")
|
let dom = domParser.parseFromString(html, "text/html")
|
||||||
let baseEl = dom.createElement('base')
|
let baseEl = dom.createElement('base')
|
||||||
|
@ -180,11 +180,11 @@ class Article extends React.Component<ArticleProps, ArticleState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
articleView = () => "article/article.html?h=" + window.btoa(encodeURIComponent(renderToString(<>
|
articleView = () => "article/article.html?h=" + encodeURIComponent(renderToString(<>
|
||||||
<p className="title">{this.props.item.title}</p>
|
<p className="title">{this.props.item.title}</p>
|
||||||
<p className="date">{this.props.item.date.toLocaleString(this.props.locale, {hour12: !this.props.locale.startsWith("zh")})}</p>
|
<p className="date">{this.props.item.date.toLocaleString(this.props.locale, {hour12: !this.props.locale.startsWith("zh")})}</p>
|
||||||
<article dangerouslySetInnerHTML={{__html: this.props.item.content}}></article>
|
<article dangerouslySetInnerHTML={{__html: this.props.item.content}}></article>
|
||||||
</>))) + `&s=${this.state.fontSize}&u=${this.props.item.link}`
|
</>)) + `&s=${this.state.fontSize}&u=${this.props.item.link}`
|
||||||
|
|
||||||
render = () => (
|
render = () => (
|
||||||
<FocusZone className="article">
|
<FocusZone className="article">
|
||||||
|
@ -57,6 +57,7 @@ export class WindowManager {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
show: false,
|
show: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
sandbox: true,
|
||||||
webviewTag: true,
|
webviewTag: true,
|
||||||
enableRemoteModule: false,
|
enableRemoteModule: false,
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
|
@ -177,7 +177,7 @@ export function fetchItems(background = false): AppThunk<Promise<void>> {
|
|||||||
let promises = new Array<Promise<RSSItem[]>>()
|
let promises = new Array<Promise<RSSItem[]>>()
|
||||||
const initState = getState()
|
const initState = getState()
|
||||||
if (!initState.app.fetchingItems && !initState.app.syncing) {
|
if (!initState.app.fetchingItems && !initState.app.syncing) {
|
||||||
await dispatch(syncWithService())
|
await dispatch(syncWithService(background))
|
||||||
let timenow = new Date().getTime()
|
let timenow = new Date().getTime()
|
||||||
let sources = <RSSSource[]>Object.values(getState().sources).filter(s => {
|
let sources = <RSSSource[]>Object.values(getState().sources).filter(s => {
|
||||||
let last = s.lastFetched ? s.lastFetched.getTime() : 0
|
let last = s.lastFetched ? s.lastFetched.getTime() : 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user