Auto-fix formatting issues
This commit is contained in:
@@ -47,6 +47,7 @@ pnpm run dev # Development with hot reload
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Testing:**
|
**Testing:**
|
||||||
|
|
||||||
- Always run `pnpm test` before committing
|
- Always run `pnpm test` before committing
|
||||||
- For CLI testing: `node dist/cli.js https://example.com --name TestApp --debug`
|
- For CLI testing: `node dist/cli.js https://example.com --name TestApp --debug`
|
||||||
- For app functionality testing: Use `pnpm run dev` for hot reload
|
- For app functionality testing: Use `pnpm run dev` for hot reload
|
||||||
|
|||||||
3
bin/helpers/merge.ts
vendored
3
bin/helpers/merge.ts
vendored
@@ -233,7 +233,8 @@ StartupNotify=true
|
|||||||
};
|
};
|
||||||
const iconInfo = platformIconMap[platform];
|
const iconInfo = platformIconMap[platform];
|
||||||
const resolvedIconPath = options.icon ? path.resolve(options.icon) : null;
|
const resolvedIconPath = options.icon ? path.resolve(options.icon) : null;
|
||||||
const exists = resolvedIconPath && (await fsExtra.pathExists(resolvedIconPath));
|
const exists =
|
||||||
|
resolvedIconPath && (await fsExtra.pathExists(resolvedIconPath));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
let updateIconPath = true;
|
let updateIconPath = true;
|
||||||
let customIconExt = path.extname(resolvedIconPath).toLowerCase();
|
let customIconExt = path.extname(resolvedIconPath).toLowerCase();
|
||||||
|
|||||||
4
bin/options/icon.ts
vendored
4
bin/options/icon.ts
vendored
@@ -46,7 +46,9 @@ const API_KEYS = {
|
|||||||
import { generateSafeFilename } from '@/utils/name';
|
import { generateSafeFilename } from '@/utils/name';
|
||||||
|
|
||||||
function generateIconPath(appName: string, isDefault = false): string {
|
function generateIconPath(appName: string, isDefault = false): string {
|
||||||
const safeName = isDefault ? 'icon' : generateSafeFilename(appName).toLowerCase();
|
const safeName = isDefault
|
||||||
|
? 'icon'
|
||||||
|
: generateSafeFilename(appName).toLowerCase();
|
||||||
const baseName = safeName;
|
const baseName = safeName;
|
||||||
|
|
||||||
if (IS_WIN) {
|
if (IS_WIN) {
|
||||||
|
|||||||
10
bin/utils/name.ts
vendored
10
bin/utils/name.ts
vendored
@@ -15,9 +15,7 @@ export function generateLinuxPackageName(name: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function generateIdentifierSafeName(name: string): string {
|
export function generateIdentifierSafeName(name: string): string {
|
||||||
return name
|
return name.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
|
||||||
.replace(/[^a-zA-Z0-9]/g, '')
|
|
||||||
.toLowerCase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateWindowsFilename(name: string): string {
|
export function generateWindowsFilename(name: string): string {
|
||||||
@@ -28,7 +26,5 @@ export function generateWindowsFilename(name: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function generateMacOSFilename(name: string): string {
|
export function generateMacOSFilename(name: string): string {
|
||||||
return name
|
return name.replace(/[:]/g, '_').slice(0, 255);
|
||||||
.replace(/[:]/g, '_')
|
}
|
||||||
.slice(0, 255);
|
|
||||||
}
|
|
||||||
|
|||||||
52
src-tauri/src/inject/event.js
vendored
52
src-tauri/src/inject/event.js
vendored
@@ -273,29 +273,31 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
binary: Array.from(binary),
|
binary: Array.from(binary),
|
||||||
language: userLanguage,
|
language: userLanguage,
|
||||||
},
|
},
|
||||||
}).catch(error => {
|
}).catch((error) => {
|
||||||
console.error('Failed to download data URI file:', filename, error);
|
console.error("Failed to download data URI file:", filename, error);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to process data URI:', dataURI, error);
|
console.error("Failed to process data URI:", dataURI, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadFromBlobUrl(blobUrl, filename) {
|
function downloadFromBlobUrl(blobUrl, filename) {
|
||||||
convertBlobUrlToBinary(blobUrl).then((binary) => {
|
convertBlobUrlToBinary(blobUrl)
|
||||||
const userLanguage = navigator.language || navigator.userLanguage;
|
.then((binary) => {
|
||||||
invoke("download_file_by_binary", {
|
const userLanguage = navigator.language || navigator.userLanguage;
|
||||||
params: {
|
invoke("download_file_by_binary", {
|
||||||
filename,
|
params: {
|
||||||
binary,
|
filename,
|
||||||
language: userLanguage,
|
binary,
|
||||||
},
|
language: userLanguage,
|
||||||
}).catch(error => {
|
},
|
||||||
console.error('Failed to download blob file:', filename, error);
|
}).catch((error) => {
|
||||||
|
console.error("Failed to download blob file:", filename, error);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Failed to convert blob to binary:", blobUrl, error);
|
||||||
});
|
});
|
||||||
}).catch(error => {
|
|
||||||
console.error('Failed to convert blob to binary:', blobUrl, error);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect blob download by createElement("a")
|
// detect blob download by createElement("a")
|
||||||
@@ -335,14 +337,14 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
const handleExternalLink = (url) => {
|
const handleExternalLink = (url) => {
|
||||||
// Don't try to open blob: or data: URLs with shell
|
// Don't try to open blob: or data: URLs with shell
|
||||||
if (isSpecialDownload(url)) {
|
if (isSpecialDownload(url)) {
|
||||||
console.warn('Cannot open special URL with shell:', url);
|
console.warn("Cannot open special URL with shell:", url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
invoke("plugin:shell|open", {
|
invoke("plugin:shell|open", {
|
||||||
path: url,
|
path: url,
|
||||||
}).catch(error => {
|
}).catch((error) => {
|
||||||
console.error('Failed to open URL with shell:', url, error);
|
console.error("Failed to open URL with shell:", url, error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -370,7 +372,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
|
|
||||||
const detectAnchorElementClick = (e) => {
|
const detectAnchorElementClick = (e) => {
|
||||||
// Safety check: ensure e.target exists and is an Element with closest method
|
// Safety check: ensure e.target exists and is an Element with closest method
|
||||||
if (!e.target || typeof e.target.closest !== 'function') {
|
if (!e.target || typeof e.target.closest !== "function") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const anchorElement = e.target.closest("a");
|
const anchorElement = e.target.closest("a");
|
||||||
@@ -723,7 +725,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for parent elements with background images
|
// Check for parent elements with background images
|
||||||
const parentWithBg = target && typeof target.closest === 'function' ? target.closest('[style*="background-image"]') : null;
|
const parentWithBg =
|
||||||
|
target && typeof target.closest === "function"
|
||||||
|
? target.closest('[style*="background-image"]')
|
||||||
|
: null;
|
||||||
if (parentWithBg) {
|
if (parentWithBg) {
|
||||||
const bgImage = parentWithBg.style.backgroundImage;
|
const bgImage = parentWithBg.style.backgroundImage;
|
||||||
const urlMatch = bgImage.match(/url\(["']?([^"')]+)["']?\)/);
|
const urlMatch = bgImage.match(/url\(["']?([^"')]+)["']?\)/);
|
||||||
@@ -792,7 +797,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
const mediaInfo = getMediaInfo(target);
|
const mediaInfo = getMediaInfo(target);
|
||||||
|
|
||||||
// Check for links (but not if it's media)
|
// Check for links (but not if it's media)
|
||||||
const linkElement = target && typeof target.closest === 'function' ? target.closest("a") : null;
|
const linkElement =
|
||||||
|
target && typeof target.closest === "function"
|
||||||
|
? target.closest("a")
|
||||||
|
: null;
|
||||||
const isLink = linkElement && linkElement.href && !mediaInfo.isMedia;
|
const isLink = linkElement && linkElement.href && !mediaInfo.isMedia;
|
||||||
|
|
||||||
// Only show custom menu for media or links
|
// Only show custom menu for media or links
|
||||||
|
|||||||
Reference in New Issue
Block a user