Skip to content

Commit 79382b0

Browse files
committed
fix: config compatibility and linux build targets
1 parent 69926f1 commit 79382b0

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed

bin/builders/BaseBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ export default abstract class BaseBuilder {
261261
} catch (error) {
262262
const shouldRetryWithoutStrip =
263263
process.platform === 'linux' &&
264-
this.options.targets === 'appimage' &&
264+
target === 'appimage' &&
265265
!buildEnv.NO_STRIP &&
266266
this.isLinuxDeployStripError(error);
267267

bin/builders/LinuxBuilder.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,20 @@ export default class LinuxBuilder extends BaseBuilder {
2626
getFileName() {
2727
const { name = 'pake-app', targets } = this.options;
2828
const version = tauriConfig.version;
29+
const buildType =
30+
this.currentBuildType || targets.split(',').map((t) => t.trim())[0];
2931

3032
let arch: string;
3133
if (this.buildArch === 'arm64') {
32-
arch = targets === 'rpm' || targets === 'appimage' ? 'aarch64' : 'arm64';
34+
arch = buildType === 'rpm' || buildType === 'appimage' ? 'aarch64' : 'arm64';
3335
} else {
3436
if (this.buildArch === 'x64') {
35-
arch = targets === 'rpm' ? 'x86_64' : 'amd64';
37+
arch = buildType === 'rpm' ? 'x86_64' : 'amd64';
3638
} else {
3739
arch = this.buildArch;
3840
if (
3941
this.buildArch === 'arm64' &&
40-
(targets === 'rpm' || targets === 'appimage')
42+
(buildType === 'rpm' || buildType === 'appimage')
4143
) {
4244
arch = 'aarch64';
4345
}

src-tauri/src/app/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub struct WindowConfig {
1919
pub title: Option<String>,
2020
pub enable_wasm: bool,
2121
pub enable_drag_drop: bool,
22+
#[serde(default)]
2223
pub new_window: bool,
2324
pub start_to_tray: bool,
2425
#[serde(default)]

src-tauri/src/inject/component.js

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ document.addEventListener("DOMContentLoaded", () => {
2424
// This bridges the HTML5 Fullscreen API to Tauri's native window fullscreen
2525
// Works for all video sites (YouTube, Vimeo, Bilibili, etc.)
2626
(function () {
27+
if (window.__PAKE_FULLSCREEN_POLYFILL__) return;
28+
window.__PAKE_FULLSCREEN_POLYFILL__ = true;
29+
2730
function initFullscreenPolyfill() {
2831
if (!window.__TAURI__ || !document.head) {
2932
setTimeout(initFullscreenPolyfill, 100);
@@ -37,11 +40,13 @@ document.addEventListener("DOMContentLoaded", () => {
3740
let originalParent = null;
3841
let originalNextSibling = null;
3942
let wasInBody = false;
43+
let monitorId = null;
4044

4145
// Inject fullscreen styles
42-
const styleEl = document.createElement("style");
43-
styleEl.id = "pake-fullscreen-style";
44-
styleEl.textContent = `
46+
if (!document.getElementById("pake-fullscreen-style")) {
47+
const styleEl = document.createElement("style");
48+
styleEl.id = "pake-fullscreen-style";
49+
styleEl.textContent = `
4550
body.pake-fullscreen-active {
4651
overflow: hidden !important;
4752
}
@@ -65,7 +70,28 @@ document.addEventListener("DOMContentLoaded", () => {
6570
object-fit: contain !important;
6671
}
6772
`;
68-
document.head.appendChild(styleEl);
73+
document.head.appendChild(styleEl);
74+
}
75+
76+
function startFullscreenMonitor() {
77+
if (monitorId) return;
78+
monitorId = setInterval(() => {
79+
appWindow
80+
.isFullscreen()
81+
.then((isFullscreen) => {
82+
if (fullscreenElement && !isFullscreen) {
83+
exitFullscreen();
84+
}
85+
})
86+
.catch(() => {});
87+
}, 500);
88+
}
89+
90+
function stopFullscreenMonitor() {
91+
if (!monitorId) return;
92+
clearInterval(monitorId);
93+
monitorId = null;
94+
}
6995

7096
// Find the actual video element
7197
function findMediaElement() {
@@ -136,6 +162,7 @@ document.addEventListener("DOMContentLoaded", () => {
136162

137163
// Fullscreen window
138164
appWindow.setFullscreen(true).then(() => {
165+
startFullscreenMonitor();
139166
const event = new Event("fullscreenchange", { bubbles: true });
140167
document.dispatchEvent(event);
141168
element.dispatchEvent(event);
@@ -156,6 +183,8 @@ document.addEventListener("DOMContentLoaded", () => {
156183
return Promise.resolve();
157184
}
158185

186+
stopFullscreenMonitor();
187+
159188
const exitingElement = fullscreenElement;
160189
const targetElement = actualFullscreenElement;
161190

@@ -252,20 +281,6 @@ document.addEventListener("DOMContentLoaded", () => {
252281
},
253282
true,
254283
);
255-
256-
// Monitor window fullscreen changes
257-
let lastFullscreenState = false;
258-
setInterval(() => {
259-
appWindow
260-
.isFullscreen()
261-
.then((isFullscreen) => {
262-
if (lastFullscreenState && !isFullscreen && fullscreenElement) {
263-
exitFullscreen();
264-
}
265-
lastFullscreenState = isFullscreen;
266-
})
267-
.catch(() => {});
268-
}, 500);
269284
}
270285

271286
initFullscreenPolyfill();

0 commit comments

Comments
 (0)