更新Linux批量打包脚本
17
app.csv
@@ -1,8 +1,9 @@
|
||||
weread,WeRead,weread.qq.com
|
||||
twitter,Twitter,twitter.com
|
||||
tranlaste,GoogleTranslate,translate.google.com
|
||||
youTube,YouTube,youtube.com
|
||||
reference,Reference,wangchujiang.com/reference/index.html
|
||||
code,Code,riju.codes
|
||||
yuque,YuQue,www.yuque.com
|
||||
flomo,Flomo,flomoapp.com/mine
|
||||
name(Linux/Windows),name(Mac),name_zh,url
|
||||
twitter,Twitter,推特,https://twitter.com/
|
||||
translate,GoogleTranslate,谷歌翻译,https://translate.google.com/
|
||||
youtube,YouTube,YouTube,https://youtube.com
|
||||
reference,Reference,Reference,https://wangchujiang.com/reference/index.html
|
||||
code,Code,Code,https://riju.codes/
|
||||
yuque,YuQue,语雀,https://www.yuque.com/
|
||||
flomo,Flomo,浮墨,https://flomoapp.com/mine
|
||||
weread,WeRead,微信阅读,https://weread.qq.com/
|
||||
|
||||
|
@@ -28,7 +28,7 @@ set old_name=weread
|
||||
set old_zh_name=微信阅读
|
||||
set old_url=weread.qq.com
|
||||
|
||||
for /f "tokens=1-3 delims=," %%i in (app.csv) do (
|
||||
for /f "skip=1 tokens=1-3 delims=," %%i in (app.csv) do (
|
||||
setlocal enabledelayedexpansion
|
||||
set name=%%i
|
||||
set name_zh=%%j
|
||||
@@ -21,56 +21,57 @@ if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
mkdir output/macos
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# total package number
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
# total app number, ignore first line
|
||||
export total=`sed -n '$=' app.csv`
|
||||
total=$(($total-1))
|
||||
export index=1
|
||||
|
||||
old_name="weread"
|
||||
old_title="WeRead"
|
||||
old_zh_name="微信阅读"
|
||||
old_url="weread.qq.com"
|
||||
old_url="https://weread.qq.com/"
|
||||
package_prefix="com-tw93"
|
||||
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
echo "==============="
|
||||
echo "Build for Linux"
|
||||
echo "==============="
|
||||
export sd=${SHELL_FOLDER}/sd-linux-x64
|
||||
# for linux, package name may be com.xxx.xxx
|
||||
echo "rename package name"
|
||||
export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop"
|
||||
sed -i "s/\"productName\": \"weread\"/\"productName\": \"${package_prefix}-weread\"/g" src-tauri/tauri.conf.json
|
||||
# sed -i "s/\"productName\": \"weread\"/\"productName\": \"${package_prefix}-weread\"/g" src-tauri/tauri.conf.json
|
||||
$sd "\"productName\": \"weread\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
echo "==============="
|
||||
echo "Build for MacOS"
|
||||
echo "==============="
|
||||
|
||||
export sd=${SHELL_FOLDER}/sd-apple-x64
|
||||
echo "rename package name"
|
||||
$sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json
|
||||
fi
|
||||
|
||||
while read line
|
||||
tail -n +2 app.csv | while IFS=, read -r -a arr;
|
||||
do
|
||||
package_name=$(echo ${line} | cut -d , -f 1)
|
||||
package_zh_name=$(echo ${line} | cut -d , -f 2)
|
||||
url=$(echo ${line} | cut -d , -f 3)
|
||||
package_name=${arr[0]}
|
||||
package_title=${arr[1]}
|
||||
package_zh_name=${arr[2]}
|
||||
url=${arr[3]}
|
||||
echo "update package name and url"
|
||||
# replace package info
|
||||
$sd ${old_url} ${url} src-tauri/tauri.conf.json
|
||||
$sd ${old_name} ${package_name} src-tauri/tauri.conf.json
|
||||
echo "update ico with 32x32 pictue"
|
||||
$sd ${old_name} ${package_name} src-tauri/src/main.rs
|
||||
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
sed -i "s/${old_url}/${url}/g" src-tauri/tauri.conf.json
|
||||
sed -i "s/${old_name}/${package_name}/g" src-tauri/tauri.conf.json
|
||||
echo "update ico with 32x32 pictue"
|
||||
sed -i "s/${old_name}/${package_name}/g" src-tauri/src/main.rs
|
||||
|
||||
fi
|
||||
|
||||
# for apple, need replace title
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
sed -i '' "s|${old_url}|${url}|g" src-tauri/tauri.conf.json
|
||||
sed -i '' "s|${old_name}|${package_name}|g" src-tauri/tauri.conf.json
|
||||
echo "update ico with 32x32 pictue"
|
||||
sed -i '' "s|${old_name}|${package_name}|g" src-tauri/src/main.rs
|
||||
$sd ${old_title} ${package_title} src-tauri/tauri.conf.json
|
||||
fi
|
||||
|
||||
# echo "update ico with 32x32 pictue"
|
||||
@@ -81,13 +82,14 @@ do
|
||||
old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop"
|
||||
new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop"
|
||||
mv ${old_desktop} ${new_desktop}
|
||||
sed -i "s/${old_zh_name}/${package_zh_name}/g" ${new_desktop}
|
||||
sed -i "s/${old_name}/${package_name}/g" ${new_desktop}
|
||||
$sd ${old_zh_name} ${package_zh_name} ${new_desktop}
|
||||
$sd ${old_name} ${package_name} ${new_desktop}
|
||||
fi
|
||||
|
||||
# update package info
|
||||
old_zh_name=${package_zh_name}
|
||||
old_name=${package_name}
|
||||
old_title=${package_title}
|
||||
old_zh_name=${package_zh_name}
|
||||
old_url=${url}
|
||||
|
||||
echo "building package ${index}/${total}"
|
||||
@@ -104,7 +106,7 @@ do
|
||||
mv src-tauri/target/release/bundle/dmg/*.dmg output/macos
|
||||
echo ""
|
||||
fi
|
||||
done < app.csv
|
||||
done
|
||||
|
||||
echo "build all package success!"
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
BIN
script/sd-apple-x64
Normal file
BIN
script/sd-linux-x64
Executable file
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 874 B |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 72 KiB |
@@ -1,175 +0,0 @@
|
||||
/**
|
||||
* @typedef {string} KeyboardKey `event.key` 的代号,
|
||||
* 见 <https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values>
|
||||
* @typedef {() => void} OnKeyDown 使用者按下 ⌘ [KeyboardKey] 时应该执行的行为
|
||||
* 以 Meta 键 (⌘) 为首的快捷键清单。
|
||||
* 每个写在这里的 shortcuts 都会运行 {@link Event.preventDefault}.
|
||||
* @type {Record<KeyboardKey, OnKeyDown>}
|
||||
*/
|
||||
const metaKeyShortcuts = {
|
||||
'ArrowUp': () => scrollTo(0, 0),
|
||||
'ArrowDown': () => scrollTo(0, document.body.scrollHeight),
|
||||
'[': () => window.history.back(),
|
||||
']': () => window.history.forward(),
|
||||
'r': () => window.location.reload(),
|
||||
'-': () => zoomOut(),
|
||||
'=': () => zoomIn(),
|
||||
'0': () => zoomCommon(() => '100%'),
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', (_event) => {
|
||||
const style = document.createElement('style');
|
||||
style.innerHTML = `
|
||||
#page #footer-wrapper,
|
||||
.drawing-board .toolbar .toolbar-action,
|
||||
.c-swiper-container,
|
||||
.download_entry,
|
||||
.lang, .copyright,
|
||||
.wwads-cn, .adsbygoogle,
|
||||
#Bottom > div.content > div.inner,
|
||||
#Rightbar .sep20:nth-of-type(5),
|
||||
#Rightbar > div.box:nth-child(4),
|
||||
#Main > div.box:nth-child(8) > div
|
||||
#Wrapper > div.sep20,
|
||||
#Main > div.box:nth-child(8),
|
||||
#masthead-ad,
|
||||
#Rightbar > div:nth-child(6) > div.sidebar_compliance {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#page .main_header {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.panel.give_me .nav_view {
|
||||
top: 154px !important;
|
||||
}
|
||||
|
||||
.columns .column #header{
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
ytd-masthead>#container.style-scope.ytd-masthead {
|
||||
padding-top: 12px !important;
|
||||
}
|
||||
|
||||
.wrap.h1body-exist.max-container > div.menu-tocs > div.menu-btn{
|
||||
top: 28px;
|
||||
}
|
||||
|
||||
#Wrapper{
|
||||
background-color: #F8F8F8 !important;
|
||||
background-image:none !important;
|
||||
}
|
||||
|
||||
#Top {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.container-with-note #home, .container-with-note #switcher{
|
||||
top: 30px;
|
||||
}
|
||||
|
||||
.geist-page nav.dashboard_nav__PRmJv {
|
||||
padding-top:10px;
|
||||
}
|
||||
|
||||
.geist-page .submenu button{
|
||||
margin-top:24px;
|
||||
}
|
||||
|
||||
#pack-top-dom:active {
|
||||
cursor: grabbing;
|
||||
cursor: -webkit-grabbing;
|
||||
}
|
||||
|
||||
#pack-top-dom{
|
||||
position:fixed;
|
||||
background:transparent;
|
||||
top:0;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
cursor: grab;
|
||||
cursor: -webkit-grab;
|
||||
z-index: 90000;
|
||||
}
|
||||
`;
|
||||
document.head.append(style);
|
||||
const topDom = document.createElement('div');
|
||||
topDom.id = 'pack-top-dom';
|
||||
document.body.appendChild(topDom);
|
||||
|
||||
const domEl = document.getElementById('pack-top-dom');
|
||||
|
||||
domEl.addEventListener('mousedown', (e) => {
|
||||
if (e.buttons === 1 && e.detail !== 2) {
|
||||
window.ipc.postMessage('drag_window');
|
||||
}
|
||||
});
|
||||
|
||||
domEl.addEventListener('touchstart', () => {
|
||||
window.ipc.postMessage('drag_window');
|
||||
});
|
||||
|
||||
domEl.addEventListener('dblclick', () => {
|
||||
window.ipc.postMessage('fullscreen');
|
||||
});
|
||||
|
||||
document.addEventListener('keyup', function (event) {
|
||||
const preventDefault = (f) => {
|
||||
event.preventDefault();
|
||||
f();
|
||||
};
|
||||
|
||||
if (event.metaKey && event.key in metaKeyShortcuts) {
|
||||
preventDefault(metaKeyShortcuts[event.key]);
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('click', (e) => {
|
||||
const origin = e.target.closest('a');
|
||||
if (origin && origin.href) {
|
||||
origin.target = '_self';
|
||||
|
||||
//额外处理下 twitter 的外跳,对于其他需要外跳的可以改这里成对应域名
|
||||
const href = origin.href;
|
||||
if(location.host === "twitter.com" && href.indexOf("twitter.com")===-1){
|
||||
e.preventDefault();
|
||||
window.ipc.postMessage(`open_browser:${href}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
setDefaultZoom();
|
||||
|
||||
function setDefaultZoom() {
|
||||
const htmlZoom = window.localStorage.getItem('htmlZoom');
|
||||
if (htmlZoom) {
|
||||
document.getElementsByTagName('html')[0].style.zoom = htmlZoom;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {(htmlZoom: string) => string} [zoomRule]
|
||||
*/
|
||||
function zoomCommon(zoomRule) {
|
||||
const htmlZoom = window.localStorage.getItem('htmlZoom') || '100%';
|
||||
const html = document.getElementsByTagName('html')[0];
|
||||
const zoom = zoomRule(htmlZoom);
|
||||
html.style.zoom = zoom;
|
||||
window.localStorage.setItem('htmlZoom', zoom);
|
||||
}
|
||||
|
||||
function zoomIn() {
|
||||
zoomCommon((htmlZoom) =>
|
||||
`${Math.min(parseInt(htmlZoom) + 10, 200)}%`
|
||||
);
|
||||
}
|
||||
|
||||
function zoomOut() {
|
||||
zoomCommon((htmlZoom) =>
|
||||
`${Math.max(parseInt(htmlZoom) - 10, 30)}%`
|
||||
);
|
||||
}
|
||||
|
||||