playworks converter

This commit is contained in:
2026-05-28 14:23:48 +08:00
parent cce30c0729
commit 2921d4d384
13 changed files with 27 additions and 30 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@@ -10,20 +10,6 @@ const root = process.cwd();
const dogCatRoot = process.env.DOGCAT_ROOT || path.join(root, 'aiAssets', 'DogCat3'); const dogCatRoot = process.env.DOGCAT_ROOT || path.join(root, 'aiAssets', 'DogCat3');
const waitMs = Number(process.env.RUNTIME_WAIT_MS || 9000); const waitMs = Number(process.env.RUNTIME_WAIT_MS || 9000);
const htmlFiles = [
['Applovin', path.join(dogCatRoot, 'Applovin', 'wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na_al.html')],
['Facebook', path.join(dogCatRoot, 'Facebook', 'wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na_fb.html')],
['Ironsource', path.join(dogCatRoot, 'Ironsource', 'wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na_is.html')],
['Moloco', path.join(dogCatRoot, 'Moloco', 'wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na_mo.html')],
['Unity', path.join(dogCatRoot, 'Unity', 'wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na_un.html')],
];
const zipFiles = [
['GoogleAds', path.join(dogCatRoot, 'GoogleAds', 'wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na_gg.zip')],
['Mintegral', path.join(dogCatRoot, 'Mintegral', 'wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na_mtg.zip')],
['Vungle', path.join(dogCatRoot, 'Vungle', 'wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na_vu.zip')],
];
const mraidStub = ` const mraidStub = `
window.mraid = window.mraid || { window.mraid = window.mraid || {
getState: function(){ return 'default'; }, getState: function(){ return 'default'; },
@@ -44,20 +30,36 @@ window.ExitApi = window.ExitApi || {
async function collectCases(tempDir) { async function collectCases(tempDir) {
const cases = []; const cases = [];
for (const [name, file] of htmlFiles) { const networkFolders = [
if (existsSync(file)) cases.push([name, await readFile(file)]); 'Applovin',
} 'Facebook',
'Ironsource',
for (const [name, zip] of zipFiles) { 'Moloco',
if (!existsSync(zip)) continue; 'Unity',
'GoogleAds',
'Mintegral',
'Vungle',
];
for (const name of networkFolders) {
const dir = path.join(dogCatRoot, name);
if (!existsSync(dir)) continue;
const entries = await readdir(dir);
const htmlName = entries.find((entry) => /\.html?$/i.test(entry));
if (htmlName) {
cases.push([name, await readFile(path.join(dir, htmlName))]);
continue;
}
const zipName = entries.find((entry) => /\.zip$/i.test(entry));
if (!zipName) continue;
const zip = path.join(dir, zipName);
const out = path.join(tempDir, name); const out = path.join(tempDir, name);
execFileSync('powershell', [ execFileSync('powershell', [
'-NoProfile', '-NoProfile',
'-Command', '-Command',
`Expand-Archive -LiteralPath '${zip.replaceAll("'", "''")}' -DestinationPath '${out.replaceAll("'", "''")}' -Force`, `Expand-Archive -LiteralPath '${zip.replaceAll("'", "''")}' -DestinationPath '${out.replaceAll("'", "''")}' -Force`,
], { stdio: 'ignore' }); ], { stdio: 'ignore' });
const entries = await readdir(out); const expanded = await readdir(out);
const indexName = entries.find((entry) => entry.toLowerCase() === 'index.html'); const indexName = expanded.find((entry) => entry.toLowerCase() === 'index.html');
if (indexName) cases.push([name, await readFile(path.join(out, indexName))]); if (indexName) cases.push([name, await readFile(path.join(out, indexName))]);
} }
return cases; return cases;

View File

@@ -44,6 +44,9 @@ func collectDogCat3MraidTargets(root string) ([]string, error) {
dir := filepath.Join(root, folder) dir := filepath.Join(root, folder)
entries, err := os.ReadDir(dir) entries, err := os.ReadDir(dir)
if err != nil { if err != nil {
if os.IsNotExist(err) {
continue
}
return nil, err return nil, err
} }
for _, entry := range entries { for _, entry := range entries {