diff --git a/app.csv b/app.csv index a8b3c79..a3aae4b 100644 --- a/app.csv +++ b/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/ diff --git a/build.bat b/script/build.bat similarity index 96% rename from build.bat rename to script/build.bat index 6e5ff9b..fed62bb 100644 --- a/build.bat +++ b/script/build.bat @@ -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 diff --git a/build.sh b/script/build.sh similarity index 63% rename from build.sh rename to script/build.sh index 327806c..e48b636 100755 --- a/build.sh +++ b/script/build.sh @@ -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 diff --git a/script/sd-apple-x64 b/script/sd-apple-x64 new file mode 100644 index 0000000..584de0c Binary files /dev/null and b/script/sd-apple-x64 differ diff --git a/script/sd-linux-x64 b/script/sd-linux-x64 new file mode 100755 index 0000000..1b05c4e Binary files /dev/null and b/script/sd-linux-x64 differ diff --git a/sd.exe b/script/sd.exe similarity index 100% rename from sd.exe rename to script/sd.exe diff --git a/src-tauri/png/aliyuque_256.ico b/src-tauri/png/aliyuque_256.ico deleted file mode 100644 index 42c62b3..0000000 Binary files a/src-tauri/png/aliyuque_256.ico and /dev/null differ diff --git a/src-tauri/png/aliyuque_32.ico b/src-tauri/png/aliyuque_32.ico deleted file mode 100644 index a993cf7..0000000 Binary files a/src-tauri/png/aliyuque_32.ico and /dev/null differ diff --git a/src-tauri/png/aliyuque_512.png b/src-tauri/png/aliyuque_512.png deleted file mode 100644 index 796f75d..0000000 Binary files a/src-tauri/png/aliyuque_512.png and /dev/null differ diff --git a/src-tauri/png/anymind_256.ico b/src-tauri/png/anymind_256.ico deleted file mode 100644 index dda2147..0000000 Binary files a/src-tauri/png/anymind_256.ico and /dev/null differ diff --git a/src-tauri/png/anymind_32.ico b/src-tauri/png/anymind_32.ico deleted file mode 100644 index a66c510..0000000 Binary files a/src-tauri/png/anymind_32.ico and /dev/null differ diff --git a/src-tauri/png/anymind_512.png b/src-tauri/png/anymind_512.png deleted file mode 100644 index 056edb2..0000000 Binary files a/src-tauri/png/anymind_512.png and /dev/null differ diff --git a/src-tauri/png/fanfou_256.ico b/src-tauri/png/fanfou_256.ico deleted file mode 100644 index 91c7d46..0000000 Binary files a/src-tauri/png/fanfou_256.ico and /dev/null differ diff --git a/src-tauri/png/fanfou_32.ico b/src-tauri/png/fanfou_32.ico deleted file mode 100644 index 14b8e1d..0000000 Binary files a/src-tauri/png/fanfou_32.ico and /dev/null differ diff --git a/src-tauri/png/fanfou_512.png b/src-tauri/png/fanfou_512.png deleted file mode 100644 index 9252593..0000000 Binary files a/src-tauri/png/fanfou_512.png and /dev/null differ diff --git a/src-tauri/png/fone_256.ico b/src-tauri/png/fone_256.ico deleted file mode 100644 index 95826c0..0000000 Binary files a/src-tauri/png/fone_256.ico and /dev/null differ diff --git a/src-tauri/png/fone_32.ico b/src-tauri/png/fone_32.ico deleted file mode 100644 index b500385..0000000 Binary files a/src-tauri/png/fone_32.ico and /dev/null differ diff --git a/src-tauri/png/fone_512.png b/src-tauri/png/fone_512.png deleted file mode 100644 index f7e096c..0000000 Binary files a/src-tauri/png/fone_512.png and /dev/null differ diff --git a/src-tauri/png/jdread_256.ico b/src-tauri/png/jdread_256.ico deleted file mode 100644 index 55512fb..0000000 Binary files a/src-tauri/png/jdread_256.ico and /dev/null differ diff --git a/src-tauri/png/jdread_32.ico b/src-tauri/png/jdread_32.ico deleted file mode 100644 index b1c54f3..0000000 Binary files a/src-tauri/png/jdread_32.ico and /dev/null differ diff --git a/src-tauri/png/jdread_512.png b/src-tauri/png/jdread_512.png deleted file mode 100644 index 5d41b36..0000000 Binary files a/src-tauri/png/jdread_512.png and /dev/null differ diff --git a/src-tauri/png/jike_256.ico b/src-tauri/png/jike_256.ico deleted file mode 100644 index c49d202..0000000 Binary files a/src-tauri/png/jike_256.ico and /dev/null differ diff --git a/src-tauri/png/jike_32.ico b/src-tauri/png/jike_32.ico deleted file mode 100644 index b5a68aa..0000000 Binary files a/src-tauri/png/jike_32.ico and /dev/null differ diff --git a/src-tauri/png/jike_512.png b/src-tauri/png/jike_512.png deleted file mode 100644 index dad7283..0000000 Binary files a/src-tauri/png/jike_512.png and /dev/null differ diff --git a/src-tauri/png/notion_256.ico b/src-tauri/png/notion_256.ico deleted file mode 100644 index ce51f05..0000000 Binary files a/src-tauri/png/notion_256.ico and /dev/null differ diff --git a/src-tauri/png/notion_32.ico b/src-tauri/png/notion_32.ico deleted file mode 100644 index 632bcf4..0000000 Binary files a/src-tauri/png/notion_32.ico and /dev/null differ diff --git a/src-tauri/png/notion_512.png b/src-tauri/png/notion_512.png deleted file mode 100644 index c5dcf0e..0000000 Binary files a/src-tauri/png/notion_512.png and /dev/null differ diff --git a/src-tauri/png/roam_256.ico b/src-tauri/png/roam_256.ico deleted file mode 100644 index ee829b8..0000000 Binary files a/src-tauri/png/roam_256.ico and /dev/null differ diff --git a/src-tauri/png/roam_32.ico b/src-tauri/png/roam_32.ico deleted file mode 100644 index 8dda778..0000000 Binary files a/src-tauri/png/roam_32.ico and /dev/null differ diff --git a/src-tauri/png/roam_512.png b/src-tauri/png/roam_512.png deleted file mode 100644 index ab5a737..0000000 Binary files a/src-tauri/png/roam_512.png and /dev/null differ diff --git a/src-tauri/png/v2ex_256.ico b/src-tauri/png/v2ex_256.ico deleted file mode 100644 index 6c5b7ef..0000000 Binary files a/src-tauri/png/v2ex_256.ico and /dev/null differ diff --git a/src-tauri/png/v2ex_32.ico b/src-tauri/png/v2ex_32.ico deleted file mode 100644 index d852d2e..0000000 Binary files a/src-tauri/png/v2ex_32.ico and /dev/null differ diff --git a/src-tauri/png/v2ex_512.png b/src-tauri/png/v2ex_512.png deleted file mode 100644 index addfc7b..0000000 Binary files a/src-tauri/png/v2ex_512.png and /dev/null differ diff --git a/src-tauri/png/vercel_256.ico b/src-tauri/png/vercel_256.ico deleted file mode 100644 index be1824a..0000000 Binary files a/src-tauri/png/vercel_256.ico and /dev/null differ diff --git a/src-tauri/png/vercel_32.ico b/src-tauri/png/vercel_32.ico deleted file mode 100644 index 59b4d77..0000000 Binary files a/src-tauri/png/vercel_32.ico and /dev/null differ diff --git a/src-tauri/png/vercel_512.png b/src-tauri/png/vercel_512.png deleted file mode 100644 index e32e178..0000000 Binary files a/src-tauri/png/vercel_512.png and /dev/null differ diff --git a/src-tauri/png/whatsapp_256.ico b/src-tauri/png/whatsapp_256.ico deleted file mode 100644 index 8b4f0c9..0000000 Binary files a/src-tauri/png/whatsapp_256.ico and /dev/null differ diff --git a/src-tauri/png/whatsapp_32.ico b/src-tauri/png/whatsapp_32.ico deleted file mode 100644 index 7327bd7..0000000 Binary files a/src-tauri/png/whatsapp_32.ico and /dev/null differ diff --git a/src-tauri/png/whatsapp_512.png b/src-tauri/png/whatsapp_512.png deleted file mode 100644 index 698656a..0000000 Binary files a/src-tauri/png/whatsapp_512.png and /dev/null differ diff --git a/src-tauri/src/pake-mac.js b/src-tauri/src/pake-mac.js deleted file mode 100644 index 51cb51e..0000000 --- a/src-tauri/src/pake-mac.js +++ /dev/null @@ -1,175 +0,0 @@ -/** - * @typedef {string} KeyboardKey `event.key` 的代号, - * 见 - * @typedef {() => void} OnKeyDown 使用者按下 ⌘ [KeyboardKey] 时应该执行的行为 - * 以 Meta 键 (⌘) 为首的快捷键清单。 - * 每个写在这里的 shortcuts 都会运行 {@link Event.preventDefault}. - * @type {Record} - */ - 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)}%` - ); -} -