Skip to content

Commit

Permalink
Merge pull request #339 from yang991178/1.1.0
Browse files Browse the repository at this point in the history
Version 1.1.0
  • Loading branch information
yang991178 committed Dec 16, 2021
2 parents 41f5b78 + dea2936 commit 73930f3
Show file tree
Hide file tree
Showing 33 changed files with 683 additions and 778 deletions.
20 changes: 12 additions & 8 deletions build/resignAndPackage.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Build the MAS app
CSC_IDENTITY_AUTO_DISCOVERY=false npx electron-builder -c electron-builder-mas.yml --mac mas:universal
# Add ElectronTeamID to Info.plist
sed -i '' -e 's/<\/dict>/<key>ElectronTeamID<\/key><string>EM8VE646TZ<\/string><\/dict>/g' "bin/darwin/universal/mas-universal/Fluent Reader.app/Contents/Info.plist"

printf "......................\nresignAndPackage start\n\n"

# Name of your app.
APP="Fluent Reader"
# Your Certificate name.
Expand All @@ -21,6 +14,17 @@ PARENT_PLIST="build/entitlements.mas.plist"
CHILD_PLIST="build/entitlements.mas.inherit.plist"
LOGINHELPER_PLIST="build/entitlements.mas.loginhelper.plist"
FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks"

# Build universal binary for font-list
# FONTLIST_PATH="node_modules/font-list/libs/darwin/fontlist.m"
# clang -arch arm64 -arch x86_64 "$FONTLIST_PATH" -fmodules -o "dist/fontlist"
# Build the MAS app
CSC_IDENTITY_AUTO_DISCOVERY=false npx electron-builder -c electron-builder-mas.yml --mac mas:universal
# Add ElectronTeamID to Info.plist
sed -i '' -e 's/<\/dict>/<key>ElectronTeamID<\/key><string>EM8VE646TZ<\/string><\/dict>/g' "bin/darwin/universal/mas-universal/Fluent Reader.app/Contents/Info.plist"

printf "......................\nresignAndPackage start\n\n"
codesign --deep --force --verify --verbose=4 --timestamp --options runtime --entitlements "$CHILD_PLIST" -s "$APP_KEY" "$APP_PATH/Contents/Resources/app.asar.unpacked/dist/fontlist"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Electron Framework"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libEGL.dylib"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib"
Expand All @@ -44,4 +48,4 @@ codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/MacO
codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH"
productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH"

printf "\nresignAndPackage end\n......................\n"
printf "\nresignAndPackage end\n......................\n"
34 changes: 32 additions & 2 deletions dist/article/article.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@

html,
body {
margin: 0;
font-family: "Segoe UI", "Source Han Sans SC Regular", "Microsoft YaHei",
sans-serif;
}
html {
body {
padding: 12px 96px 32px;
overflow: hidden scroll;
}
body.rtl {
direction: rtl;
}
body.vertical {
padding: 32px;
padding-right: 96px;
writing-mode: vertical-rl;
overflow: scroll hidden;
}

:root {
margin: 12px 96px 32px;
--gray: #484644;
--primary: #0078d4;
--primary-alt: #004578;
Expand Down Expand Up @@ -58,6 +69,11 @@ a:active {
margin: 0 auto;
display: none;
}
body.vertical #main {
max-width: unset;
max-height: 700px;
margin: auto 0;
}
#main.show {
display: block;
animation-name: fadeIn;
Expand All @@ -80,12 +96,21 @@ a:active {
article {
line-height: 1.6;
}
body.vertical article {
line-height: 1.5;
}
body.vertical article p {
text-indent: 2rem;
}
article * {
max-width: 100%;
}
article img {
height: auto;
}
body.vertical article img {
max-height: 75%;
}
article figure {
margin: 16px 0;
text-align: center;
Expand All @@ -103,6 +128,11 @@ article code {
font-size: 0.875rem;
line-height: 1;
}
article pre {
word-break: normal;
overflow-wrap: normal;
white-space: pre-wrap;
}
article blockquote {
border-left: 2px solid var(--gray);
margin: 1em 0;
Expand Down
4 changes: 2 additions & 2 deletions dist/article/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; script-src-elem 'sha256-sLDWrq1tUAO8IyyqmUckFqxbXYfZ2/3TEUmtxH8Unf0=' 'sha256-9YXu4Ifpt+hDzuBhE+vFtXKt1ZRbo/CkuUY4VX4dZyE='; img-src http: https: data:; style-src 'self' 'unsafe-inline'; frame-src http: https:; media-src http: https:; connect-src https: http:">
content="default-src 'none'; script-src-elem 'sha256-sLDWrq1tUAO8IyyqmUckFqxbXYfZ2/3TEUmtxH8Unf0=' 'sha256-iOdZeo0zvgcSuiH/7/dXCOHo7s0cn2XtsidqVOcHBjo='; img-src http: https: data:; style-src 'self' 'unsafe-inline'; frame-src http: https:; media-src http: https:; connect-src https: http:">
<title>Article</title>
<link rel="stylesheet" href="article.css" />
<script integrity="sha256-sLDWrq1tUAO8IyyqmUckFqxbXYfZ2/3TEUmtxH8Unf0=" src="mercury.web.js"></script>
</head>
<body>
<div id="main"></div>
<script integrity="sha256-9YXu4Ifpt+hDzuBhE+vFtXKt1ZRbo/CkuUY4VX4dZyE=" src="article.js"></script>
<script integrity="sha256-iOdZeo0zvgcSuiH/7/dXCOHo7s0cn2XtsidqVOcHBjo=" src="article.js"></script>
<!-- Run "cat article.js | openssl dgst -sha256 -binary | openssl enc -base64 -A" for hash -->
</body>
</html>
12 changes: 11 additions & 1 deletion dist/article/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ function get(name) {
if (name = (new RegExp('[?&]' + encodeURIComponent(name) + '=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
}
let dir = get("d")
if (dir === "1") {
document.body.classList.add("rtl")
} else if (dir === "2") {
document.body.classList.add("vertical")
document.body.addEventListener("wheel", (evt) => {
document.scrollingElement.scrollLeft -= evt.deltaY;
});
}
async function getArticle(url) {
let article = get("a")
if (get("m") === "1") {
Expand All @@ -11,6 +20,8 @@ async function getArticle(url) {
}
}
document.documentElement.style.fontSize = get("s") + "px"
let font = get("f")
if (font) document.body.style.fontFamily = `"${font}"`
let url = get("u")
getArticle(url).then(article => {
let domParser = new DOMParser()
Expand All @@ -32,4 +43,3 @@ getArticle(url).then(article => {
main.innerHTML = dom.body.innerHTML
main.classList.add("show")
})

Binary file added dist/fontlist
Binary file not shown.
29 changes: 29 additions & 0 deletions dist/fonts.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Option Explicit

Dim objShell, objFSO, objFile, objFolder
Dim objFolderItem, colItems, objFont
Dim strFileName


Const FONTS = &H14& ' Fonts Folder

' Instantiate Objects
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(FONTS)
Set objFolderItem = objFolder.Self
Set colItems = objFolder.Items
Set objFSO = CreateObject("Scripting.FileSystemObject")

For Each objFont in colItems
WScript.StdOut.WriteLine(objFont.Path & vbtab & objFont.Name)
Next

Set objShell = nothing
Set objFile = nothing
Set objFolder = nothing
Set objFolderItem = nothing
Set colItems = nothing
Set objFont = nothing
Set objFSO = nothing

wscript.quit
4 changes: 4 additions & 0 deletions dist/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ i.ms-Nav-chevron {
color: var(--neutralPrimary);
}

.ms-Callout-main {
border-radius: 5px;
}

#root > nav {
height: var(--navHeight);
-webkit-app-region: drag;
Expand Down
4 changes: 4 additions & 0 deletions electron-builder-mas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ productName: Fluent Reader
copyright: Copyright © 2020 Haoyuan Liu
files:
- "./dist/**/*"
- "!./dist/fonts.vbs"
- "!**/*.js.map"
asarUnpack:
- "./dist/fontlist"
directories:
output: "./bin/${platform}/${arch}/"
mac:
Expand All @@ -25,6 +28,7 @@ mac:
- uk
- it
- nl
- ko
minimumSystemVersion: 10.14.0
mas:
entitlements: build/entitlements.mas.plist
Expand Down
3 changes: 3 additions & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ productName: Fluent Reader
copyright: Copyright © 2020 Haoyuan Liu
files:
- "./dist/**/*"
- "!./dist/fontlist"
- "!**/*.js.map"
directories:
output: "./bin/${platform}/${arch}/"
Expand All @@ -24,6 +25,7 @@ mac:
- uk
- it
- nl
- ko
win:
target:
- nsis
Expand All @@ -46,6 +48,7 @@ appx:
- uk
- it
- nl
- ko
showNameOnTiles: true
setBuildNumber: true
nsis:
Expand Down

0 comments on commit 73930f3

Please sign in to comment.