pake-cli 3.7.5 โ 3.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/src-tauri/Cargo.lock +1 -1
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/capabilities/default.json +4 -0
- package/src-tauri/gen/schemas/capabilities.json +1 -1
- package/src-tauri/src/inject/component.js +237 -0
- package/src-tauri/src/lib.rs +10 -0
package/dist/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ import * as psl from 'psl';
|
|
|
22
22
|
import { InvalidArgumentError, program as program$1, Option } from 'commander';
|
|
23
23
|
|
|
24
24
|
var name = "pake-cli";
|
|
25
|
-
var version = "3.7.
|
|
25
|
+
var version = "3.7.7";
|
|
26
26
|
var description = "๐คฑ๐ป Turn any webpage into a desktop app with one command. ๐คฑ๐ป ไธ้ฎๆๅ
็ฝ้กต็ๆ่ฝป้ๆก้ขๅบ็จใ";
|
|
27
27
|
var engines = {
|
|
28
28
|
node: ">=18.0.0"
|
package/package.json
CHANGED
package/src-tauri/Cargo.lock
CHANGED
package/src-tauri/Cargo.toml
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"core:window:allow-toggle-maximize",
|
|
14
14
|
"core:window:allow-is-fullscreen",
|
|
15
15
|
"core:window:allow-set-fullscreen",
|
|
16
|
+
"core:window:allow-set-resizable",
|
|
17
|
+
"core:window:allow-maximize",
|
|
18
|
+
"core:window:allow-minimize",
|
|
19
|
+
"core:window:allow-close",
|
|
16
20
|
"core:webview:allow-internal-toggle-devtools",
|
|
17
21
|
"notification:allow-is-permission-granted",
|
|
18
22
|
"notification:allow-notify",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"pake-capability":{"identifier":"pake-capability","description":"Capability for the pake app.","remote":{"urls":["https://*.*"]},"local":true,"webviews":["pake"],"permissions":["shell:allow-open","core:window:allow-theme","core:window:allow-start-dragging","core:window:allow-toggle-maximize","core:window:allow-is-fullscreen","core:window:allow-set-fullscreen","core:webview:allow-internal-toggle-devtools","notification:allow-is-permission-granted","notification:allow-notify","notification:allow-get-active","notification:allow-register-listener","notification:allow-register-action-types","notification:default","core:path:default"]}}
|
|
1
|
+
{"pake-capability":{"identifier":"pake-capability","description":"Capability for the pake app.","remote":{"urls":["https://*.*"]},"local":true,"webviews":["pake"],"permissions":["shell:allow-open","core:window:allow-theme","core:window:allow-start-dragging","core:window:allow-toggle-maximize","core:window:allow-is-fullscreen","core:window:allow-set-fullscreen","core:window:allow-set-resizable","core:window:allow-maximize","core:window:allow-minimize","core:window:allow-close","core:webview:allow-internal-toggle-devtools","notification:allow-is-permission-granted","notification:allow-notify","notification:allow-get-active","notification:allow-register-listener","notification:allow-register-action-types","notification:default","core:path:default"]}}
|
|
@@ -19,3 +19,240 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
19
19
|
|
|
20
20
|
window.pakeToast = pakeToast;
|
|
21
21
|
});
|
|
22
|
+
|
|
23
|
+
// Polyfill for HTML5 Fullscreen API in Tauri webview
|
|
24
|
+
// This bridges the HTML5 Fullscreen API to Tauri's native window fullscreen
|
|
25
|
+
// Works for all video sites (YouTube, Vimeo, Bilibili, etc.)
|
|
26
|
+
(function () {
|
|
27
|
+
function initFullscreenPolyfill() {
|
|
28
|
+
if (!window.__TAURI__ || !document.head) {
|
|
29
|
+
setTimeout(initFullscreenPolyfill, 100);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const appWindow = window.__TAURI__.window.getCurrentWindow();
|
|
34
|
+
let fullscreenElement = null;
|
|
35
|
+
let actualFullscreenElement = null;
|
|
36
|
+
let originalStyles = null;
|
|
37
|
+
let originalParent = null;
|
|
38
|
+
let originalNextSibling = null;
|
|
39
|
+
let wasInBody = false;
|
|
40
|
+
|
|
41
|
+
// Inject fullscreen styles
|
|
42
|
+
const styleEl = document.createElement('style');
|
|
43
|
+
styleEl.id = 'pake-fullscreen-style';
|
|
44
|
+
styleEl.textContent = `
|
|
45
|
+
body.pake-fullscreen-active {
|
|
46
|
+
overflow: hidden !important;
|
|
47
|
+
}
|
|
48
|
+
.pake-fullscreen-element {
|
|
49
|
+
position: fixed !important;
|
|
50
|
+
top: 0 !important;
|
|
51
|
+
left: 0 !important;
|
|
52
|
+
width: 100vw !important;
|
|
53
|
+
height: 100vh !important;
|
|
54
|
+
max-width: 100vw !important;
|
|
55
|
+
max-height: 100vh !important;
|
|
56
|
+
margin: 0 !important;
|
|
57
|
+
padding: 0 !important;
|
|
58
|
+
z-index: 2147483647 !important;
|
|
59
|
+
background: #000 !important;
|
|
60
|
+
object-fit: contain !important;
|
|
61
|
+
}
|
|
62
|
+
.pake-fullscreen-element video {
|
|
63
|
+
width: 100% !important;
|
|
64
|
+
height: 100% !important;
|
|
65
|
+
object-fit: contain !important;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
document.head.appendChild(styleEl);
|
|
69
|
+
|
|
70
|
+
// Find the actual video element
|
|
71
|
+
function findMediaElement() {
|
|
72
|
+
const videos = document.querySelectorAll('video');
|
|
73
|
+
if (videos.length > 0) {
|
|
74
|
+
let largestVideo = videos[0];
|
|
75
|
+
let maxArea = 0;
|
|
76
|
+
videos.forEach(video => {
|
|
77
|
+
const rect = video.getBoundingClientRect();
|
|
78
|
+
const area = rect.width * rect.height;
|
|
79
|
+
if (area > maxArea || !video.paused) {
|
|
80
|
+
maxArea = area;
|
|
81
|
+
largestVideo = video;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return largestVideo;
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Enter fullscreen
|
|
90
|
+
function enterFullscreen(element) {
|
|
91
|
+
fullscreenElement = element;
|
|
92
|
+
|
|
93
|
+
// If html/body element, find the video instead
|
|
94
|
+
let targetElement = element;
|
|
95
|
+
if (element === document.documentElement || element === document.body) {
|
|
96
|
+
const mediaElement = findMediaElement();
|
|
97
|
+
if (mediaElement) {
|
|
98
|
+
targetElement = mediaElement;
|
|
99
|
+
actualFullscreenElement = mediaElement;
|
|
100
|
+
} else {
|
|
101
|
+
actualFullscreenElement = element;
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
actualFullscreenElement = element;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Save original state
|
|
108
|
+
originalStyles = {
|
|
109
|
+
position: targetElement.style.position,
|
|
110
|
+
top: targetElement.style.top,
|
|
111
|
+
left: targetElement.style.left,
|
|
112
|
+
width: targetElement.style.width,
|
|
113
|
+
height: targetElement.style.height,
|
|
114
|
+
maxWidth: targetElement.style.maxWidth,
|
|
115
|
+
maxHeight: targetElement.style.maxHeight,
|
|
116
|
+
margin: targetElement.style.margin,
|
|
117
|
+
padding: targetElement.style.padding,
|
|
118
|
+
zIndex: targetElement.style.zIndex,
|
|
119
|
+
background: targetElement.style.background,
|
|
120
|
+
objectFit: targetElement.style.objectFit,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
wasInBody = targetElement.parentNode === document.body;
|
|
124
|
+
if (!wasInBody) {
|
|
125
|
+
originalParent = targetElement.parentNode;
|
|
126
|
+
originalNextSibling = targetElement.nextSibling;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Apply fullscreen
|
|
130
|
+
targetElement.classList.add('pake-fullscreen-element');
|
|
131
|
+
document.body.classList.add('pake-fullscreen-active');
|
|
132
|
+
|
|
133
|
+
if (!wasInBody) {
|
|
134
|
+
document.body.appendChild(targetElement);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Fullscreen window
|
|
138
|
+
appWindow.setFullscreen(true).then(() => {
|
|
139
|
+
const event = new Event('fullscreenchange', { bubbles: true });
|
|
140
|
+
document.dispatchEvent(event);
|
|
141
|
+
element.dispatchEvent(event);
|
|
142
|
+
|
|
143
|
+
const webkitEvent = new Event('webkitfullscreenchange', { bubbles: true });
|
|
144
|
+
document.dispatchEvent(webkitEvent);
|
|
145
|
+
element.dispatchEvent(webkitEvent);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
return Promise.resolve();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Exit fullscreen
|
|
152
|
+
function exitFullscreen() {
|
|
153
|
+
if (!fullscreenElement) {
|
|
154
|
+
return Promise.resolve();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const exitingElement = fullscreenElement;
|
|
158
|
+
const targetElement = actualFullscreenElement;
|
|
159
|
+
|
|
160
|
+
// Restore styles and position
|
|
161
|
+
targetElement.classList.remove('pake-fullscreen-element');
|
|
162
|
+
document.body.classList.remove('pake-fullscreen-active');
|
|
163
|
+
|
|
164
|
+
if (originalStyles) {
|
|
165
|
+
Object.keys(originalStyles).forEach(key => {
|
|
166
|
+
targetElement.style[key] = originalStyles[key];
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (!wasInBody && originalParent) {
|
|
171
|
+
if (originalNextSibling && originalNextSibling.parentNode === originalParent) {
|
|
172
|
+
originalParent.insertBefore(targetElement, originalNextSibling);
|
|
173
|
+
} else if (originalParent.isConnected) {
|
|
174
|
+
originalParent.appendChild(targetElement);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Reset state
|
|
179
|
+
fullscreenElement = null;
|
|
180
|
+
actualFullscreenElement = null;
|
|
181
|
+
originalStyles = null;
|
|
182
|
+
originalParent = null;
|
|
183
|
+
originalNextSibling = null;
|
|
184
|
+
wasInBody = false;
|
|
185
|
+
|
|
186
|
+
// Exit window fullscreen
|
|
187
|
+
return appWindow.setFullscreen(false).then(() => {
|
|
188
|
+
const event = new Event('fullscreenchange', { bubbles: true });
|
|
189
|
+
document.dispatchEvent(event);
|
|
190
|
+
exitingElement.dispatchEvent(event);
|
|
191
|
+
|
|
192
|
+
const webkitEvent = new Event('webkitfullscreenchange', { bubbles: true });
|
|
193
|
+
document.dispatchEvent(webkitEvent);
|
|
194
|
+
exitingElement.dispatchEvent(webkitEvent);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Override fullscreenEnabled
|
|
199
|
+
Object.defineProperty(document, 'fullscreenEnabled', {
|
|
200
|
+
get: () => true,
|
|
201
|
+
configurable: true
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(document, 'webkitFullscreenEnabled', {
|
|
204
|
+
get: () => true,
|
|
205
|
+
configurable: true
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// Override fullscreenElement
|
|
209
|
+
Object.defineProperty(document, 'fullscreenElement', {
|
|
210
|
+
get: () => fullscreenElement,
|
|
211
|
+
configurable: true
|
|
212
|
+
});
|
|
213
|
+
Object.defineProperty(document, 'webkitFullscreenElement', {
|
|
214
|
+
get: () => fullscreenElement,
|
|
215
|
+
configurable: true
|
|
216
|
+
});
|
|
217
|
+
Object.defineProperty(document, 'webkitCurrentFullScreenElement', {
|
|
218
|
+
get: () => fullscreenElement,
|
|
219
|
+
configurable: true
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// Override requestFullscreen
|
|
223
|
+
Element.prototype.requestFullscreen = function () {
|
|
224
|
+
return enterFullscreen(this);
|
|
225
|
+
};
|
|
226
|
+
Element.prototype.webkitRequestFullscreen = function () {
|
|
227
|
+
return enterFullscreen(this);
|
|
228
|
+
};
|
|
229
|
+
Element.prototype.webkitRequestFullScreen = function () {
|
|
230
|
+
return enterFullscreen(this);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// Override exitFullscreen
|
|
234
|
+
document.exitFullscreen = exitFullscreen;
|
|
235
|
+
document.webkitExitFullscreen = exitFullscreen;
|
|
236
|
+
document.webkitCancelFullScreen = exitFullscreen;
|
|
237
|
+
|
|
238
|
+
// Handle Escape key
|
|
239
|
+
document.addEventListener('keydown', (e) => {
|
|
240
|
+
if (e.key === 'Escape' && fullscreenElement) {
|
|
241
|
+
exitFullscreen();
|
|
242
|
+
}
|
|
243
|
+
}, true);
|
|
244
|
+
|
|
245
|
+
// Monitor window fullscreen changes
|
|
246
|
+
let lastFullscreenState = false;
|
|
247
|
+
setInterval(() => {
|
|
248
|
+
appWindow.isFullscreen().then(isFullscreen => {
|
|
249
|
+
if (lastFullscreenState && !isFullscreen && fullscreenElement) {
|
|
250
|
+
exitFullscreen();
|
|
251
|
+
}
|
|
252
|
+
lastFullscreenState = isFullscreen;
|
|
253
|
+
}).catch(() => {});
|
|
254
|
+
}, 500);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
initFullscreenPolyfill();
|
|
258
|
+
})();
|
package/src-tauri/src/lib.rs
CHANGED
|
@@ -105,6 +105,8 @@ pub fn run_app() {
|
|
|
105
105
|
{
|
|
106
106
|
if init_fullscreen {
|
|
107
107
|
window_clone.set_fullscreen(true).unwrap();
|
|
108
|
+
// Ensure webview maintains focus for input after fullscreen
|
|
109
|
+
let _ = window_clone.set_focus();
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
});
|
|
@@ -125,6 +127,14 @@ pub fn run_app() {
|
|
|
125
127
|
tokio::time::sleep(Duration::from_millis(900)).await;
|
|
126
128
|
}
|
|
127
129
|
}
|
|
130
|
+
#[cfg(all(not(target_os = "windows"), not(target_os = "macos")))]
|
|
131
|
+
{
|
|
132
|
+
if window.is_fullscreen().unwrap_or(false) {
|
|
133
|
+
window.set_fullscreen(false).unwrap();
|
|
134
|
+
// Restore focus after exiting fullscreen to fix input issues
|
|
135
|
+
let _ = window.set_focus();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
128
138
|
window.minimize().unwrap();
|
|
129
139
|
window.hide().unwrap();
|
|
130
140
|
});
|