🐛 解决历史存量

This commit is contained in:
Tw93
2023-04-08 21:43:27 +08:00
parent 6f42109517
commit 61de4d871b
7 changed files with 11 additions and 126 deletions

View File

@@ -171,9 +171,6 @@ npm i
# Local development
npm run dev
# Local debug
npm run dev:debug
# Pack application
npm run build
```
@@ -183,7 +180,7 @@ npm run build
1. You can refer to the [codebase structure](https://github.com/tw93/Pake/wiki/Description-of-Pake's-code-structure) before working on Pake, which will help you much in development.
2. Modify the `url` and `productName` fields in the `tauri.conf.json` file under the src-tauri directory, as well as the `icon` and `identifier` fields in the `tauri.xxx.conf.json` file. You can select a `icon` from the `icons` directory or download one from [macOSicons](https://macosicons.com/#/) to match your product needs.
3. For configurations on window properties, you can modify the `tauri.conf.json` file to change the value of `width`, `height`, `fullscreen` (or not), `resizable` (or not) of the `windows` property. To adapt to the immersive header on Mac, change `transparent` to `true`, look for the `Header` element, and add the `padding-top` property.
4. For advanced usages such as style rewriting, advertisement removal, JS injection, container message communication, and user-defined shortcut keys, see [Advanced Usage of Make](https://github.com/tw93/Pake/wiki/Advanced-Usage-of-Make).
4. For advanced usages such as style rewriting, advertisement removal, JS injection, container message communication, and user-defined shortcut keys, see [Advanced Usage of Make](https://github.com/tw93/Pake/wiki/Advanced-Usage-of-Pake).
## Developer

View File

@@ -172,9 +172,6 @@ npm i
# 本地开发
npm run dev
# 本地调试
npm run dev:debug
# 打包应用
npm run build

View File

@@ -32,7 +32,6 @@
"scripts": {
"start": "npm run dev",
"dev": "npm run tauri dev",
"dev:debug": "npm run tauri dev -- --features devtools",
"build": "npm run tauri build --release",
"build:mac": "npm run tauri build -- --target universal-apple-darwin",
"build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",

View File

@@ -17,7 +17,7 @@ tauri-build = { version = "1.2.1", features = [] }
[dependencies]
serde_json = "1.0.89"
serde = { version = "1.0.150", features = ["derive"] }
tauri = { version = "1.2.1", features = ["api-all", "devtools", "system-tray"] }
tauri = { version = "1.2.4", features = ["api-all", "system-tray"] }
image = "0.24.5"
home = "0.5"
dirs = "5.0"

View File

@@ -36,7 +36,7 @@ window.addEventListener('DOMContentLoaded', (_event) => {
}
.fui-FluentProvider .fui-Button[data-testid="HomeButton"]{
padding-top: 20px;
padding-top: 20px;
}
.chakra-ui-light #app .chakra-heading,
@@ -45,7 +45,7 @@ window.addEventListener('DOMContentLoaded', (_event) => {
.chakra-ui-dark #app .chakra-stack,
.app-main .sidebar-mouse-in-out,
.chakra-modal__content-container .chakra-modal__header > div > div {
padding-top: 10px;
padding-top: 10px;
}
#__next .overflow-hidden>.hidden.bg-gray-900 span.rounded-md.bg-yellow-200 {
@@ -57,7 +57,7 @@ window.addEventListener('DOMContentLoaded', (_event) => {
}
#__next .absolute .px-3.pt-2.pb-3.text-center {
visibility: hidden;
visibility: hidden;
}
.lark > .dashboard-sidebar, .lark > .dashboard-sidebar > .sidebar-user-info , .lark > .dashboard-sidebar .index-module_wrapper_F-Wbq{
@@ -266,109 +266,13 @@ window.addEventListener('DOMContentLoaded', (_event) => {
width: 100%;
height: 20px;
cursor: grab;
cursor: -webkit-grab;
-webkit-app-region: drag;
user-select: none;
-webkit-user-select: none;
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) => {
e && e.preventDefault();
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 (/windows|linux/i.test(navigator.userAgent)) {
if (event.ctrlKey && event.key in ctrlKeyShortcuts) {
preventDefault(ctrlKeyShortcuts[event.key]);
}
}
if (/macintosh|mac os x/i.test(navigator.userAgent)) {
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) {
const target = origin.target
origin.target = "_self";
const hrefUrl = new URL(origin.href)
if (
window.location.host !== hrefUrl.host && // 如果 a 标签内链接的域名和当前页面的域名不一致 且
target === '_blank' // a 标签内链接的 target 属性为 _blank 时
) {
e.preventDefault();
window.ipc.postMessage(`open_browser:${origin.href}`);
}
}
});
const styleElement = document.createElement('style');
styleElement.innerHTML = css;
document.head.appendChild(styleElement);
});
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)}%`);
}
function pakeToast(msg) {
const m = document.createElement('div');
m.innerHTML = msg;
m.style.cssText = "max-width:60%;min-width: 180px;padding:0 8px;height: 36px;color: rgb(255, 255, 255);line-height: 36px;text-align: center;border-radius: 4px;position: fixed;bottom:16px;right: 16px;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.9);font-size: 14px;";
document.body.appendChild(m);
setTimeout(function() {
const d = 0.5;
m.style.transition = 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
m.style.opacity = '0';
setTimeout(function() {
document.body.removeChild(m)
}, d * 1000);
}, 2500);
}

View File

@@ -52,10 +52,6 @@ pub fn run_app() {
// Prevent initial shaking
_window.restore_state(StateFlags::all()).unwrap();
_window.show().unwrap();
#[cfg(feature = "devtools")]
{
_window.open_devtools();
}
Ok(())
})
.on_window_event(|event| {

View File

@@ -8,16 +8,8 @@
"copyright": "",
"deb": {
"depends": [
"libwebkit2gtk-4.0-dev",
"build-essential",
"curl",
"wget",
"libssl-dev",
"libgtk-3-dev",
"libayatana-appindicator3-dev",
"librsvg2-dev",
"gnome-video-effects",
"gnome-video-effects-extra"
"wget"
],
"files": {
"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"