Comparing version 2.5.0 to 2.5.1
@@ -23,3 +23,3 @@ import chalk from 'chalk'; | ||
var name = "pake-cli"; | ||
var version = "2.5.0"; | ||
var version = "2.5.1"; | ||
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。"; | ||
@@ -469,5 +469,7 @@ var engines = { | ||
if (file.endsWith('.css')) { | ||
return "window.addEventListener('DOMContentLoaded', (_event) => { const css = `" + fileContent + "`; const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); });"; | ||
return ("window.addEventListener('DOMContentLoaded', (_event) => { const css = `" + | ||
fileContent + | ||
"`; const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); });"); | ||
} | ||
return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent + " });"; | ||
return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent + ' });'; | ||
}); | ||
@@ -638,3 +640,3 @@ fs.writeFileSync(output, contents.join('\n')); | ||
} | ||
const files = inject.map(filepath => path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath)); | ||
const files = inject.map(filepath => (path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath))); | ||
tauriConf.pake.inject = files; | ||
@@ -1020,7 +1022,4 @@ await combineFiles(files, injectFilePath); | ||
`; | ||
program.addHelpText('beforeAll', logo).usage(`[url] [options]`).showHelpAfterError(); | ||
program | ||
.addHelpText('beforeAll', logo) | ||
.usage(`[url] [options]`) | ||
.showHelpAfterError(); | ||
program | ||
.argument('[url]', 'The web URL you want to package', validateUrlInput) | ||
@@ -1041,4 +1040,8 @@ .option('--name <string>', 'Application name') | ||
.addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT_PAKE_OPTIONS.alwaysOnTop).hideHelp()) | ||
.addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts).hideHelp()) | ||
.addOption(new Option('--safe-domain [domains...]', 'Domains that Require Security Configuration').default(DEFAULT_PAKE_OPTIONS.safeDomain).hideHelp()) | ||
.addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts') | ||
.default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts) | ||
.hideHelp()) | ||
.addOption(new Option('--safe-domain [domains...]', 'Domains that Require Security Configuration') | ||
.default(DEFAULT_PAKE_OPTIONS.safeDomain) | ||
.hideHelp()) | ||
.addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_PAKE_OPTIONS.showSystemTray).hideHelp()) | ||
@@ -1045,0 +1048,0 @@ .addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp()) |
{ | ||
"name": "pake-cli", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -9,7 +9,7 @@ document.addEventListener('DOMContentLoaded', () => { | ||
document.body.appendChild(m); | ||
setTimeout(function() { | ||
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() { | ||
setTimeout(function () { | ||
document.body.removeChild(m); | ||
@@ -21,3 +21,2 @@ }, d * 1000); | ||
window.pakeToast = pakeToast; | ||
}); |
const shortcuts = { | ||
'ArrowUp': () => scrollTo(0, 0), | ||
'ArrowDown': () => scrollTo(0, document.body.scrollHeight), | ||
'[': () => window.history.back(), | ||
']': () => window.history.forward(), | ||
'r': () => window.location.reload(), | ||
'-': () => zoomOut(), | ||
'=': () => zoomIn(), | ||
'+': () => zoomIn(), | ||
'0': () => setZoom('100%'), | ||
0: () => setZoom('100%'), | ||
r: () => window.location.reload(), | ||
ArrowUp: () => scrollTo(0, 0), | ||
ArrowDown: () => scrollTo(0, document.body.scrollHeight), | ||
}; | ||
@@ -25,7 +25,7 @@ | ||
function zoomIn() { | ||
zoomCommon((currentZoom) => `${Math.min(parseInt(currentZoom) + 10, 200)}%`); | ||
zoomCommon(currentZoom => `${Math.min(parseInt(currentZoom) + 10, 200)}%`); | ||
} | ||
function zoomOut() { | ||
zoomCommon((currentZoom) => `${Math.max(parseInt(currentZoom) - 10, 30)}%`); | ||
zoomCommon(currentZoom => `${Math.max(parseInt(currentZoom) - 10, 30)}%`); | ||
} | ||
@@ -42,7 +42,10 @@ | ||
function isDownloadLink(url) { | ||
// prettier-ignore | ||
const fileExtensions = [ | ||
'3gp', '7z', 'ai', 'apk', 'avi', 'bmp', 'csv', 'dmg', 'doc', 'docx', 'fla', 'flv', 'gif', 'gz', 'gzip', | ||
'ico', 'iso', 'indd', 'jar', 'jpeg', 'jpg', 'm3u8', 'mov', 'mp3', 'mp4', 'mpa', 'mpg', | ||
'mpeg', 'msi', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'psd', 'rar', 'raw', 'rss', 'svg', | ||
'swf', 'tar', 'tif', 'tiff', 'ts', 'txt', 'wav', 'webm', 'webp', 'wma', 'wmv', 'xls', 'xlsx', 'xml', 'zip', | ||
'3gp', '7z', 'ai', 'apk', 'avi', 'bmp', 'csv', 'dmg', 'doc', 'docx', | ||
'fla', 'flv', 'gif', 'gz', 'gzip', 'ico', 'iso', 'indd', 'jar', 'jpeg', | ||
'jpg', 'm3u8', 'mov', 'mp3', 'mp4', 'mpa', 'mpg', 'mpeg', 'msi', 'odt', | ||
'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'psd', 'rar', 'raw', 'rss', | ||
'svg', 'swf', 'tar', 'tif', 'tiff', 'ts', 'txt', 'wav', 'webm', 'webp', | ||
'wma', 'wmv', 'xls', 'xlsx', 'xml', 'zip', 'json', 'yaml', '7zip', 'mkv' | ||
]; | ||
@@ -80,3 +83,3 @@ const downloadLinkPattern = new RegExp(`\\.(${fileExtensions.join('|')})$`, 'i'); | ||
domEl.addEventListener('mousedown', (e) => { | ||
domEl.addEventListener('mousedown', e => { | ||
e.preventDefault(); | ||
@@ -89,3 +92,3 @@ if (e.buttons === 1 && e.detail !== 2) { | ||
domEl.addEventListener('dblclick', () => { | ||
appWindow.isFullscreen().then((fullscreen) => { | ||
appWindow.isFullscreen().then(fullscreen => { | ||
appWindow.setFullscreen(!fullscreen).then(); | ||
@@ -96,3 +99,3 @@ }); | ||
if (window['pakeConfig']?.disabled_web_shortcuts !== true) { | ||
document.addEventListener('keyup', (event) => { | ||
document.addEventListener('keyup', event => { | ||
if (/windows|linux/i.test(navigator.userAgent) && event.ctrlKey) { | ||
@@ -111,3 +114,3 @@ handleShortcut(event); | ||
window.blobToUrlCaches = new Map(); | ||
window.URL.createObjectURL = (blob) => { | ||
window.URL.createObjectURL = blob => { | ||
const url = backupCreateObjectURL.call(window.URL, blob); | ||
@@ -120,3 +123,3 @@ window.blobToUrlCaches.set(url, blob); | ||
function convertBlobUrlToBinary(blobUrl) { | ||
return new Promise((resolve) => { | ||
return new Promise(resolve => { | ||
const blob = window.blobToUrlCaches.get(blobUrl); | ||
@@ -155,3 +158,3 @@ const reader = new FileReader(); | ||
function downloadFromBlobUrl(blobUrl, filename) { | ||
convertBlobUrlToBinary(blobUrl).then((binary) => { | ||
convertBlobUrlToBinary(blobUrl).then(binary => { | ||
invoke('download_file_by_binary', { | ||
@@ -166,6 +169,6 @@ params: { | ||
// detect blob download by createElement("a") | ||
// detect blob download by createElement("a") | ||
function detectDownloadByCreateAnchor() { | ||
const createEle = document.createElement; | ||
document.createElement = (el) => { | ||
document.createElement = el => { | ||
if (el !== 'a') return createEle.call(document, el); | ||
@@ -175,14 +178,18 @@ const anchorEle = createEle.call(document, el); | ||
// use addEventListener to avoid overriding the original click event. | ||
anchorEle.addEventListener('click', (e) => { | ||
const url = anchorEle.href; | ||
const filename = anchorEle.download || getFilenameFromUrl(url); | ||
if (window.blobToUrlCaches.has(url)) { | ||
downloadFromBlobUrl(url, filename); | ||
// case: download from dataURL -> convert dataURL -> | ||
} else if (url.startsWith('data:')) { | ||
downloadFromDataUri(url, filename); | ||
} else if (isDownloadLink(url) || anchorEle.hostname !== window.location.host) { | ||
handleExternalLink(e, url); | ||
} | ||
}, true); | ||
anchorEle.addEventListener( | ||
'click', | ||
e => { | ||
const url = anchorEle.href; | ||
const filename = anchorEle.download || getFilenameFromUrl(url); | ||
if (window.blobToUrlCaches.has(url)) { | ||
downloadFromBlobUrl(url, filename); | ||
// case: download from dataURL -> convert dataURL -> | ||
} else if (url.startsWith('data:')) { | ||
downloadFromDataUri(url, filename); | ||
} else if (isDownloadLink(url) || anchorEle.hostname !== window.location.host) { | ||
handleExternalLink(e, url); | ||
} | ||
}, | ||
true, | ||
); | ||
@@ -193,8 +200,7 @@ return anchorEle; | ||
const isExternalLink = (link) => window.location.host !== link.host; | ||
const isExternalLink = link => window.location.host !== link.host; | ||
// process special download protocol['data:','blob:'] | ||
const isSpecialDownload = (url) => ['blob', 'data'].some(protocol => url.startsWith(protocol)); | ||
const isSpecialDownload = url => ['blob', 'data'].some(protocol => url.startsWith(protocol)); | ||
const isDownloadRequired = (url, anchorElement, e) => | ||
anchorElement.download || e.metaKey || e.ctrlKey || isDownloadLink(url); | ||
const isDownloadRequired = (url, anchorElement, e) => anchorElement.download || e.metaKey || e.ctrlKey || isDownloadLink(url); | ||
@@ -211,3 +217,3 @@ const handleExternalLink = (e, url) => { | ||
const detectAnchorElementClick = (e) => { | ||
const detectAnchorElementClick = e => { | ||
const anchorElement = e.target.closest('a'); | ||
@@ -241,3 +247,3 @@ if (anchorElement && anchorElement.href) { | ||
const originalWindowOpen = window.open; | ||
window.open = function(url, name, specs) { | ||
window.open = function (url, name, specs) { | ||
// Apple login and google login | ||
@@ -265,6 +271,9 @@ if (name === 'AppleAuthentication') { | ||
// Fix Chinese input method "Enter" on Safari | ||
document.addEventListener('keydown', (e) => { | ||
if (e.keyCode === 229) e.stopPropagation(); | ||
}, true); | ||
document.addEventListener( | ||
'keydown', | ||
e => { | ||
if (e.keyCode === 229) e.stopPropagation(); | ||
}, | ||
true, | ||
); | ||
}); | ||
@@ -271,0 +280,0 @@ |
@@ -11,3 +11,3 @@ { | ||
"depends": ["curl", "wget"], | ||
"files": {"/usr/share/applications/com-pake-weread.desktop": "assets/com-pake-weread.desktop"} | ||
"files": { "/usr/share/applications/com-pake-weread.desktop": "assets/com-pake-weread.desktop" } | ||
}, | ||
@@ -14,0 +14,0 @@ "externalBin": [], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11327231
2773