Comparing version 2.1.6 to 2.1.7
@@ -23,3 +23,3 @@ import chalk from 'chalk'; | ||
var name = "pake-cli"; | ||
var version = "2.1.6"; | ||
var version = "2.1.7"; | ||
var description = "๐คฑ๐ป Turn any webpage into a desktop app with Rust. ๐คฑ๐ป ๅพ็ฎๅ็็จ Rust ๆๅ ็ฝ้กต็ๆๅพๅฐ็ๆก้ข Appใ"; | ||
@@ -309,3 +309,3 @@ var engines = { | ||
darwin: MacConf, | ||
linux: LinuxConf | ||
linux: LinuxConf, | ||
}; | ||
@@ -322,3 +322,3 @@ const { platform: platform$2 } = process; | ||
build: CommonConf.build, | ||
pake: pakeConf | ||
pake: pakeConf, | ||
}; | ||
@@ -328,6 +328,3 @@ | ||
function getIdentifier(url) { | ||
const postFixHash = crypto.createHash('md5') | ||
.update(url) | ||
.digest('hex') | ||
.substring(0, 6); | ||
const postFixHash = crypto.createHash('md5').update(url).digest('hex').substring(0, 6); | ||
return `pake-${postFixHash}`; | ||
@@ -349,15 +346,10 @@ } | ||
const loadingType = { | ||
"interval": 80, | ||
"frames": [ | ||
"โฆ", | ||
"โถ", | ||
"โบ", | ||
"โต", | ||
"โธ", | ||
"โด๏ธ", | ||
"โน", | ||
"โบ", | ||
] | ||
interval: 80, | ||
frames: ['โฆ', 'โถ', 'โบ', 'โต', 'โธ', 'โน', 'โบ'], | ||
}; | ||
return ora({ text: `${chalk.blue(text)}\n`, spinner: loadingType, color: 'blue' }).start(); | ||
return ora({ | ||
text: `${chalk.cyan(text)}\n`, | ||
spinner: loadingType, | ||
color: 'cyan', | ||
}).start(); | ||
} | ||
@@ -377,3 +369,3 @@ | ||
return new Promise((resolve, reject) => { | ||
shelljs.exec(command, { async: true, silent: false, cwd: npmDirectory }, (code) => { | ||
shelljs.exec(command, { async: true, silent: false, cwd: npmDirectory }, code => { | ||
if (code === 0) { | ||
@@ -391,3 +383,3 @@ resolve(0); | ||
info(...msg) { | ||
log.info(...msg.map((m) => chalk.white(m))); | ||
log.info(...msg.map(m => chalk.white(m))); | ||
}, | ||
@@ -398,10 +390,10 @@ debug(...msg) { | ||
error(...msg) { | ||
log.error(...msg.map((m) => chalk.red(m))); | ||
log.error(...msg.map(m => chalk.red(m))); | ||
}, | ||
warn(...msg) { | ||
log.info(...msg.map((m) => chalk.yellow(m))); | ||
log.info(...msg.map(m => chalk.yellow(m))); | ||
}, | ||
success(...msg) { | ||
log.info(...msg.map((m) => chalk.green(m))); | ||
} | ||
log.info(...msg.map(m => chalk.green(m))); | ||
}, | ||
}; | ||
@@ -416,3 +408,3 @@ | ||
const requestPromise = new Promise((resolve, reject) => { | ||
const req = http.get(`http://${ip.address}`, (res) => { | ||
const req = http.get(`http://${ip.address}`, res => { | ||
const delay = new Date().getTime() - start.getTime(); | ||
@@ -422,3 +414,3 @@ res.resume(); | ||
}); | ||
req.on('error', (err) => { | ||
req.on('error', err => { | ||
reject(err); | ||
@@ -457,3 +449,3 @@ }); | ||
async function installRust() { | ||
const isInChina = await isChinaDomain("sh.rustup.rs"); | ||
const isInChina = await isChinaDomain('sh.rustup.rs'); | ||
const rustInstallScriptForMac = isInChina | ||
@@ -509,3 +501,3 @@ ? 'export RUSTUP_DIST_SERVER="https://rsproxy.cn" && export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" && curl --proto "=https" --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh' | ||
const filesToCopyBack = ['cli.js', 'about_pake.html']; | ||
await Promise.all(filesToCopyBack.map((file) => fsExtra.copy(path.join(distBakDir, file), path.join(distDir, file)))); | ||
await Promise.all(filesToCopyBack.map(file => fsExtra.copy(path.join(distBakDir, file), path.join(distDir, file)))); | ||
} | ||
@@ -518,4 +510,3 @@ tauriConf.pake.windows[0].url = fileName; | ||
// Set the secure domain for calling window.__TAURI__ to the application domain that has been set. | ||
tauriConf.tauri.security.dangerousRemoteDomainIpcAccess[0].domain = | ||
new URL(url).hostname; | ||
tauriConf.tauri.security.dangerousRemoteDomainIpcAccess[0].domain = new URL(url).hostname; | ||
} | ||
@@ -538,3 +529,4 @@ const platformMap = { | ||
if (validTargets.includes(options.targets)) { | ||
tauriConf.tauri.bundle.targets = options.targets === 'all' ? ['deb', 'appimage'] : [options.targets]; | ||
tauriConf.tauri.bundle.targets = | ||
options.targets === 'all' ? ['deb', 'appimage'] : [options.targets]; | ||
} | ||
@@ -639,4 +631,4 @@ else { | ||
if (!IS_MAC) { | ||
logger.info('โ๏ธ The first use requires installing system dependencies.'); | ||
logger.info('โ๏ธ See more in https://tauri.app/v1/guides/getting-started/prerequisites.'); | ||
logger.info('โบ The first use requires installing system dependencies.'); | ||
logger.info('โบ See more in https://tauri.app/v1/guides/getting-started/prerequisites.'); | ||
} | ||
@@ -657,10 +649,10 @@ if (!checkRustInstalled()) { | ||
} | ||
const isChina = await isChinaDomain("www.npmjs.com"); | ||
const isChina = await isChinaDomain('www.npmjs.com'); | ||
const spinner = getSpinner('Installing package...'); | ||
if (isChina) { | ||
logger.info("โ๏ธ Located in China, using npm/rsProxy CN mirror."); | ||
const rustProjectDir = path.join(npmDirectory, 'src-tauri', ".cargo"); | ||
logger.info('โบ Located in China, using npm/rsProxy CN mirror.'); | ||
const rustProjectDir = path.join(npmDirectory, 'src-tauri', '.cargo'); | ||
await fsExtra.ensureDir(rustProjectDir); | ||
const projectCnConf = path.join(npmDirectory, "src-tauri", "rust_proxy.toml"); | ||
const projectConf = path.join(rustProjectDir, "config"); | ||
const projectCnConf = path.join(npmDirectory, 'src-tauri', 'rust_proxy.toml'); | ||
const projectConf = path.join(rustProjectDir, 'config'); | ||
await fsExtra.copy(projectCnConf, projectConf); | ||
@@ -698,3 +690,3 @@ await shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com`); | ||
getBuildCommand() { | ||
return "npm run build"; | ||
return 'npm run build'; | ||
} | ||
@@ -712,3 +704,3 @@ getBasePath() { | ||
super(options); | ||
this.options.targets = "dmg"; | ||
this.options.targets = 'dmg'; | ||
} | ||
@@ -722,3 +714,3 @@ getFileName() { | ||
else { | ||
arch = process.arch === "arm64" ? "aarch64" : process.arch; | ||
arch = process.arch === 'arm64' ? 'aarch64' : process.arch; | ||
} | ||
@@ -740,3 +732,3 @@ return `${name}_${tauriConfig.package.version}_${arch}`; | ||
super(options); | ||
this.options.targets = "msi"; | ||
this.options.targets = 'msi'; | ||
} | ||
@@ -757,3 +749,3 @@ getFileName() { | ||
const { name } = this.options; | ||
const arch = process.arch === "x64" ? "amd64" : process.arch; | ||
const arch = process.arch === 'x64' ? 'amd64' : process.arch; | ||
return `${name}_${tauriConfig.package.version}_${arch}`; | ||
@@ -763,5 +755,5 @@ } | ||
async build(url) { | ||
const targetTypes = ["deb", "appimage"]; | ||
const targetTypes = ['deb', 'appimage']; | ||
for (const target of targetTypes) { | ||
if (this.options.targets === target || this.options.targets === "all") { | ||
if (this.options.targets === target || this.options.targets === 'all') { | ||
await this.buildAndCopy(url, target); | ||
@@ -827,3 +819,7 @@ } | ||
logger.warn('โผ No icon given, default in use. For a custom icon, use --icon option.'); | ||
const iconPath = IS_WIN ? 'src-tauri/png/icon_256.ico' : IS_LINUX ? 'src-tauri/png/icon_512.png' : 'src-tauri/icons/icon.icns'; | ||
const iconPath = IS_WIN | ||
? 'src-tauri/png/icon_256.ico' | ||
: IS_LINUX | ||
? 'src-tauri/png/icon_512.png' | ||
: 'src-tauri/icons/icon.icns'; | ||
return path.join(npmDirectory, iconPath); | ||
@@ -866,3 +862,3 @@ } | ||
// If domain is available, split it and return the SLD. | ||
if ("domain" in parsed && parsed.domain) { | ||
if ('domain' in parsed && parsed.domain) { | ||
return parsed.domain.split('.')[0]; | ||
@@ -917,3 +913,3 @@ } | ||
if (!options.name) { | ||
const defaultName = pathExists ? "" : resolveAppName(url, platform); | ||
const defaultName = pathExists ? '' : resolveAppName(url, platform); | ||
const promptMessage = 'Enter your application name'; | ||
@@ -989,6 +985,6 @@ const namePrompt = await promptText(promptMessage, defaultName); | ||
if (!url) { | ||
program.outputHelp((str) => { | ||
program.outputHelp(str => { | ||
return str | ||
.split('\n') | ||
.filter((line) => !/((-h,|--help)|((-v|-V),|--version))\s+.+$/.test(line)) | ||
.filter(line => !/((-h,|--help)|((-v|-V),|--version))\s+.+$/.test(line)) | ||
.join('\n'); | ||
@@ -995,0 +991,0 @@ }); |
{ | ||
"name": "pake-cli", | ||
"version": "2.1.6", | ||
"version": "2.1.7", | ||
"description": "๐คฑ๐ป Turn any webpage into a desktop app with Rust. ๐คฑ๐ป ๅพ็ฎๅ็็จ Rust ๆๅ ็ฝ้กต็ๆๅพๅฐ็ๆก้ข Appใ", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -139,4 +139,3 @@ document.addEventListener('DOMContentLoaded', () => { | ||
const d = 0.5; | ||
m.style.transition = | ||
'transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; | ||
m.style.transition = 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; | ||
m.style.opacity = '0'; | ||
@@ -155,3 +154,3 @@ setTimeout(function () { | ||
window.fetch = (url, options) => { | ||
return originFetch(url, options).then(async (response) => { | ||
return originFetch(url, options).then(async response => { | ||
if (url.indexOf('/backend-api/models') === -1) { | ||
@@ -162,4 +161,4 @@ return response; | ||
let res = await responseClone.json(); | ||
res.models = res.models.map((m) => { | ||
m.tags = m.tags.filter((t) => { | ||
res.models = res.models.map(m => { | ||
m.tags = m.tags.filter(t => { | ||
return t !== 'mobile'; | ||
@@ -166,0 +165,0 @@ }); |
@@ -85,10 +85,10 @@ const shortcuts = { | ||
function isDownloadLink(url) { | ||
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' | ||
]; | ||
const downloadLinkPattern = new RegExp(`\\.(${fileExtensions.join('|')})$`, 'i'); | ||
return downloadLinkPattern.test(url); | ||
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', | ||
]; | ||
const downloadLinkPattern = new RegExp(`\\.(${fileExtensions.join('|')})$`, 'i'); | ||
return downloadLinkPattern.test(url); | ||
} | ||
@@ -189,3 +189,3 @@ | ||
const originalWindowOpen = window.open; | ||
window.open = function (url, name, specs) { | ||
window.open = function(url, name, specs) { | ||
// Apple login and google login | ||
@@ -283,3 +283,3 @@ if (name === 'AppleAuthentication') { | ||
document.createElement = (el) => { | ||
if (el !== "a") return createEle.call(document, el); | ||
if (el !== 'a') return createEle.call(document, el); | ||
const anchorEle = createEle.call(document, el); | ||
@@ -296,3 +296,3 @@ | ||
return anchorEle; | ||
} | ||
}; | ||
} |
@@ -1,2 +0,2 @@ | ||
window.addEventListener('DOMContentLoaded', (_event) => { | ||
window.addEventListener('DOMContentLoaded', _event => { | ||
const css = ` | ||
@@ -3,0 +3,0 @@ #page #footer-wrapper, |
@@ -12,5 +12,3 @@ { | ||
"domain": "weread.qq.com", | ||
"windows": [ | ||
"pake" | ||
], | ||
"windows": ["pake"], | ||
"enableTauriAPI": true | ||
@@ -31,5 +29,3 @@ } | ||
"all": true, | ||
"scope": [ | ||
"$DOWNLOAD/*" | ||
] | ||
"scope": ["$DOWNLOAD/*"] | ||
} | ||
@@ -36,0 +32,0 @@ } |
@@ -11,3 +11,5 @@ { | ||
"depends": ["curl", "wget"], | ||
"files": {"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"} | ||
"files": { | ||
"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop" | ||
} | ||
}, | ||
@@ -14,0 +16,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
11687529
1824