更新Linux批量打包脚本

This commit is contained in:
Tlntin
2022-11-20 10:35:21 +08:00
parent 5b9e5a7228
commit be9aeb64b4
40 changed files with 39 additions and 211 deletions

17
app.csv
View File

@@ -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/
1 weread name(Linux/Windows) WeRead name(Mac) weread.qq.com name_zh url
2 twitter twitter Twitter Twitter twitter.com 推特 https://twitter.com/
3 tranlaste translate GoogleTranslate GoogleTranslate translate.google.com 谷歌翻译 https://translate.google.com/
4 youTube youtube YouTube YouTube youtube.com YouTube https://youtube.com
5 reference reference Reference Reference wangchujiang.com/reference/index.html Reference https://wangchujiang.com/reference/index.html
6 code code Code Code riju.codes Code https://riju.codes/
7 yuque yuque YuQue YuQue www.yuque.com 语雀 https://www.yuque.com/
8 flomo flomo Flomo Flomo flomoapp.com/mine 浮墨 https://flomoapp.com/mine
9 weread WeRead 微信阅读 https://weread.qq.com/

View File

@@ -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

View File

@@ -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

Binary file not shown.

BIN
script/sd-linux-x64 Executable file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

View File

@@ -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)}%`
);
}