Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: config compatibility and linux build targets

Tw9379382b0743fd
diff --git a/bin/builders/BaseBuilder.ts b/bin/builders/BaseBuilder.ts
index 60176a29..c87feb45 100644
--- a/bin/builders/BaseBuilder.ts
+++ b/bin/builders/BaseBuilder.ts
@@ -261,7 +261,7 @@ export default abstract class BaseBuilder {
} catch (error) {
const shouldRetryWithoutStrip =
process.platform === 'linux' &&
- this.options.targets === 'appimage' &&
+ target === 'appimage' &&
!buildEnv.NO_STRIP &&
this.isLinuxDeployStripError(error);
diff --git a/bin/builders/LinuxBuilder.ts b/bin/builders/LinuxBuilder.ts
index e8450da1..5e1dc970 100644
--- a/bin/builders/LinuxBuilder.ts
+++ b/bin/builders/LinuxBuilder.ts
@@ -26,18 +26,20 @@ export default class LinuxBuilder extends BaseBuilder {
getFileName() {
const { name = 'pake-app', targets } = this.options;
const version = tauriConfig.version;
+ const buildType =
+ this.currentBuildType || targets.split(',').map((t) => t.trim())[0];
let arch: string;
if (this.buildArch === 'arm64') {
- arch = targets === 'rpm' || targets === 'appimage' ? 'aarch64' : 'arm64';
+ arch = buildType === 'rpm' || buildType === 'appimage' ? 'aarch64' : 'arm64';
} else {
if (this.buildArch === 'x64') {
- arch = targets === 'rpm' ? 'x86_64' : 'amd64';
+ arch = buildType === 'rpm' ? 'x86_64' : 'amd64';
} else {
arch = this.buildArch;
if (
this.buildArch === 'arm64' &&
- (targets === 'rpm' || targets === 'appimage')
+ (buildType === 'rpm' || buildType === 'appimage')
) {
arch = 'aarch64';
}
diff --git a/src-tauri/src/app/config.rs b/src-tauri/src/app/config.rs
index f9402c6c..d753a543 100644
--- a/src-tauri/src/app/config.rs
+++ b/src-tauri/src/app/config.rs
@@ -19,6 +19,7 @@ pub struct WindowConfig {
pub title: Option<String>,
pub enable_wasm: bool,
pub enable_drag_drop: bool,
+ #[serde(default)]
pub new_window: bool,
pub start_to_tray: bool,
#[serde(default)]
diff --git a/src-tauri/src/inject/component.js b/src-tauri/src/inject/component.js
index bec0d9d8..8a068fcd 100644
--- a/src-tauri/src/inject/component.js
+++ b/src-tauri/src/inject/component.js
@@ -24,6 +24,9 @@ document.addEventListener("DOMContentLoaded", () => {
// This bridges the HTML5 Fullscreen API to Tauri's native window fullscreen
// Works for all video sites (YouTube, Vimeo, Bilibili, etc.)
(function () {
+ if (window.__PAKE_FULLSCREEN_POLYFILL__) return;
+ window.__PAKE_FULLSCREEN_POLYFILL__ = true;
+
function initFullscreenPolyfill() {
if (!window.__TAURI__ || !document.head) {
setTimeout(initFullscreenPolyfill, 100);
@@ -37,11 +40,13 @@ document.addEventListener("DOMContentLoaded", () => {
let originalParent = null;
let originalNextSibling = null;
let wasInBody = false;
+ let monitorId = null;
// Inject fullscreen styles
- const styleEl = document.createElement("style");
- styleEl.id = "pake-fullscreen-style";
- styleEl.textContent = `
+ if (!document.getElementById("pake-fullscreen-style")) {
+ const styleEl = document.createElement("style");
+ styleEl.id = "pake-fullscreen-style";
+ styleEl.textContent = `
body.pake-fullscreen-active {
overflow: hidden !important;
}
@@ -65,7 +70,28 @@ document.addEventListener("DOMContentLoaded", () => {
object-fit: contain !important;
}
`;
- document.head.appendChild(styleEl);
+ document.head.appendChild(styleEl);
+ }
+
+ function startFullscreenMonitor() {
+ if (monitorId) return;
+ monitorId = setInterval(() => {
+ appWindow
+ .isFullscreen()
+ .then((isFullscreen) => {
+ if (fullscreenElement && !isFullscreen) {
+ exitFullscreen();
+ }
+ })
+ .catch(() => {});
+ }, 500);
+ }
+
+ function stopFullscreenMonitor() {
+ if (!monitorId) return;
+ clearInterval(monitorId);
+ monitorId = null;
+ }
// Find the actual video element
function findMediaElement() {
@@ -136,6 +162,7 @@ document.addEventListener("DOMContentLoaded", () => {
// Fullscreen window
appWindow.setFullscreen(true).then(() => {
+ startFullscreenMonitor();
const event = new Event("fullscreenchange", { bubbles: true });
document.dispatchEvent(event);
element.dispatchEvent(event);
@@ -156,6 +183,8 @@ document.addEventListener("DOMContentLoaded", () => {
return Promise.resolve();
}
+ stopFullscreenMonitor();
+
const exitingElement = fullscreenElement;
const targetElement = actualFullscreenElement;
@@ -252,20 +281,6 @@ document.addEventListener("DOMContentLoaded", () => {
},
true,
);
-
- // Monitor window fullscreen changes
- let lastFullscreenState = false;
- setInterval(() => {
- appWindow
- .isFullscreen()
- .then((isFullscreen) => {
- if (lastFullscreenState && !isFullscreen && fullscreenElement) {
- exitFullscreen();
- }
- lastFullscreenState = isFullscreen;
- })
- .catch(() => {});
- }, 500);
}
initFullscreenPolyfill();