playworks converter
This commit is contained in:
File diff suppressed because one or more lines are too long
BIN
dist/hpl-toolbox-0.1.6.exe
vendored
BIN
dist/hpl-toolbox-0.1.6.exe
vendored
Binary file not shown.
BIN
dist/hpl-toolbox-0.1.6.vsix
vendored
BIN
dist/hpl-toolbox-0.1.6.vsix
vendored
Binary file not shown.
@@ -10,20 +10,6 @@ const root = process.cwd();
|
||||
const dogCatRoot = process.env.DOGCAT_ROOT || path.join(root, 'aiAssets', 'DogCat3');
|
||||
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 = `
|
||||
window.mraid = window.mraid || {
|
||||
getState: function(){ return 'default'; },
|
||||
@@ -44,20 +30,36 @@ window.ExitApi = window.ExitApi || {
|
||||
|
||||
async function collectCases(tempDir) {
|
||||
const cases = [];
|
||||
for (const [name, file] of htmlFiles) {
|
||||
if (existsSync(file)) cases.push([name, await readFile(file)]);
|
||||
}
|
||||
|
||||
for (const [name, zip] of zipFiles) {
|
||||
if (!existsSync(zip)) continue;
|
||||
const networkFolders = [
|
||||
'Applovin',
|
||||
'Facebook',
|
||||
'Ironsource',
|
||||
'Moloco',
|
||||
'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);
|
||||
execFileSync('powershell', [
|
||||
'-NoProfile',
|
||||
'-Command',
|
||||
`Expand-Archive -LiteralPath '${zip.replaceAll("'", "''")}' -DestinationPath '${out.replaceAll("'", "''")}' -Force`,
|
||||
], { stdio: 'ignore' });
|
||||
const entries = await readdir(out);
|
||||
const indexName = entries.find((entry) => entry.toLowerCase() === 'index.html');
|
||||
const expanded = await readdir(out);
|
||||
const indexName = expanded.find((entry) => entry.toLowerCase() === 'index.html');
|
||||
if (indexName) cases.push([name, await readFile(path.join(out, indexName))]);
|
||||
}
|
||||
return cases;
|
||||
|
||||
@@ -44,6 +44,9 @@ func collectDogCat3MraidTargets(root string) ([]string, error) {
|
||||
dir := filepath.Join(root, folder)
|
||||
entries, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
for _, entry := range entries {
|
||||
|
||||
Reference in New Issue
Block a user