fix: 更新 site.webmanifest 和 base.tsx,新增多語言支持及應用元數據
This commit is contained in:
parent
944fe18b75
commit
506340ecda
3 changed files with 73 additions and 9 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "ConvertX-CN | Self Hosted File Converter",
|
"name": "ConvertX-CN | 自架檔案轉換器",
|
||||||
"short_name": "ConvertX-CN",
|
"short_name": "ConvertX-CN",
|
||||||
|
"description": "自架式多格式檔案轉換工具,支援文件、圖片、音訊、影片等多種格式轉換",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/android-chrome-192x192.png",
|
"src": "/android-chrome-192x192.png",
|
||||||
|
|
@ -15,5 +16,9 @@
|
||||||
],
|
],
|
||||||
"theme_color": "#a5d601",
|
"theme_color": "#a5d601",
|
||||||
"background_color": "#13171f",
|
"background_color": "#13171f",
|
||||||
"display": "standalone"
|
"display": "standalone",
|
||||||
|
"start_url": "/",
|
||||||
|
"scope": "/",
|
||||||
|
"lang": "zh-TW",
|
||||||
|
"categories": ["utilities", "productivity"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,12 @@ export const BaseHtml = ({
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="webroot" content={webroot} />
|
<meta name="webroot" content={webroot} />
|
||||||
<meta name="locale" content={locale} />
|
<meta name="locale" content={locale} />
|
||||||
|
<meta name="application-name" content="ConvertX-CN" />
|
||||||
|
<meta name="apple-mobile-web-app-title" content="ConvertX-CN" />
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="description" content="自架式多格式檔案轉換工具" />
|
||||||
|
<meta name="theme-color" content="#a5d601" />
|
||||||
<title safe>{title}</title>
|
<title safe>{title}</title>
|
||||||
<link rel="stylesheet" href={`${webroot}/generated.css`} />
|
<link rel="stylesheet" href={`${webroot}/generated.css`} />
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href={`${webroot}/apple-touch-icon.png`} />
|
<link rel="apple-touch-icon" sizes="180x180" href={`${webroot}/apple-touch-icon.png`} />
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,48 @@ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { spawnSync } from "node:child_process";
|
import { spawnSync } from "node:child_process";
|
||||||
|
|
||||||
|
// 靜態導入所有轉換器
|
||||||
|
import { convert as convertInkscape } from "../../src/converters/inkscape";
|
||||||
|
import { convert as convertImagemagick } from "../../src/converters/imagemagick";
|
||||||
|
import { convert as convertGraphicsmagick } from "../../src/converters/graphicsmagick";
|
||||||
|
import { convert as convertPandoc } from "../../src/converters/pandoc";
|
||||||
|
import { convert as convertDasel } from "../../src/converters/dasel";
|
||||||
|
import { convert as convertPotrace } from "../../src/converters/potrace";
|
||||||
|
import { convert as convertVtracer } from "../../src/converters/vtracer";
|
||||||
|
import { convert as convertResvg } from "../../src/converters/resvg";
|
||||||
|
import { convert as convertVips } from "../../src/converters/vips";
|
||||||
|
import { convert as convertLibreoffice } from "../../src/converters/libreoffice";
|
||||||
|
import { convert as convertCalibre } from "../../src/converters/calibre";
|
||||||
|
import { convert as convertFfmpeg } from "../../src/converters/ffmpeg";
|
||||||
|
import { convert as convertLibheif } from "../../src/converters/libheif";
|
||||||
|
import { convert as convertLibjxl } from "../../src/converters/libjxl";
|
||||||
|
|
||||||
|
// 轉換器映射表
|
||||||
|
type ConvertFn = (
|
||||||
|
filePath: string,
|
||||||
|
fileType: string,
|
||||||
|
convertTo: string,
|
||||||
|
targetPath: string,
|
||||||
|
options?: unknown,
|
||||||
|
) => Promise<string>;
|
||||||
|
|
||||||
|
const converterMap: Record<string, ConvertFn> = {
|
||||||
|
inkscape: convertInkscape,
|
||||||
|
imagemagick: convertImagemagick,
|
||||||
|
graphicsmagick: convertGraphicsmagick,
|
||||||
|
pandoc: convertPandoc,
|
||||||
|
dasel: convertDasel,
|
||||||
|
potrace: convertPotrace,
|
||||||
|
vtracer: convertVtracer,
|
||||||
|
resvg: convertResvg,
|
||||||
|
vips: convertVips,
|
||||||
|
libreoffice: convertLibreoffice,
|
||||||
|
calibre: convertCalibre,
|
||||||
|
ffmpeg: convertFfmpeg,
|
||||||
|
libheif: convertLibheif,
|
||||||
|
libjxl: convertLibjxl,
|
||||||
|
};
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// 配置
|
// 配置
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
@ -501,9 +543,12 @@ describe("📊 格式轉換矩陣 Format Conversion Matrix", () => {
|
||||||
writeFileSync(inputPath, content, "utf-8");
|
writeFileSync(inputPath, content, "utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 動態導入並執行轉換
|
// 使用靜態導入的轉換器映射表
|
||||||
const module = await import(`../../src/converters/${converterName}`);
|
const convertFn = converterMap[converterName];
|
||||||
await module.convert(inputPath, from, to, outputPath);
|
if (!convertFn) {
|
||||||
|
throw new Error(`Converter not found in converterMap: ${converterName}`);
|
||||||
|
}
|
||||||
|
await convertFn(inputPath, from, to, outputPath);
|
||||||
|
|
||||||
const duration = Date.now() - startTime;
|
const duration = Date.now() - startTime;
|
||||||
const success = existsSync(outputPath);
|
const success = existsSync(outputPath);
|
||||||
|
|
@ -595,12 +640,16 @@ describe("📊 格式轉換矩陣 Format Conversion Matrix", () => {
|
||||||
writeFileSync(inputPath, content, "utf-8");
|
writeFileSync(inputPath, content, "utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
const module = await import(`../../src/converters/${converterName}`);
|
// 使用靜態導入的轉換器映射表
|
||||||
|
const convertFn = converterMap[converterName];
|
||||||
|
if (!convertFn) {
|
||||||
|
throw new Error(`Converter not found in converterMap: ${converterName}`);
|
||||||
|
}
|
||||||
// 對於 Pandoc,正規化格式名稱
|
// 對於 Pandoc,正規化格式名稱
|
||||||
const normalizedFrom =
|
const normalizedFrom =
|
||||||
converterName === "pandoc" ? normalizeFormatForPandoc(from) : from;
|
converterName === "pandoc" ? normalizeFormatForPandoc(from) : from;
|
||||||
const normalizedTo = converterName === "pandoc" ? normalizeFormatForPandoc(to) : to;
|
const normalizedTo = converterName === "pandoc" ? normalizeFormatForPandoc(to) : to;
|
||||||
await module.convert(inputPath, normalizedFrom, normalizedTo, outputPath);
|
await convertFn(inputPath, normalizedFrom, normalizedTo, outputPath);
|
||||||
|
|
||||||
const duration = Date.now() - startTime;
|
const duration = Date.now() - startTime;
|
||||||
const success = existsSync(outputPath);
|
const success = existsSync(outputPath);
|
||||||
|
|
@ -681,8 +730,12 @@ describe("📊 格式轉換矩陣 Format Conversion Matrix", () => {
|
||||||
const content = createTestContent(from);
|
const content = createTestContent(from);
|
||||||
writeFileSync(inputPath, content, "utf-8");
|
writeFileSync(inputPath, content, "utf-8");
|
||||||
|
|
||||||
const module = await import(`../../src/converters/${converterName}`);
|
// 使用靜態導入的轉換器映射表
|
||||||
await module.convert(inputPath, from, to, outputPath);
|
const convertFn = converterMap[converterName];
|
||||||
|
if (!convertFn) {
|
||||||
|
throw new Error(`Converter not found in converterMap: ${converterName}`);
|
||||||
|
}
|
||||||
|
await convertFn(inputPath, from, to, outputPath);
|
||||||
|
|
||||||
const duration = Date.now() - startTime;
|
const duration = Date.now() - startTime;
|
||||||
const success = existsSync(outputPath);
|
const success = existsSync(outputPath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue