0.1.6
This commit is contained in:
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.
@@ -75,6 +75,11 @@ export function openPlayworksConverter(_context: vscode.ExtensionContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const results: NetworkResult[] = [];
|
const results: NetworkResult[] = [];
|
||||||
|
try {
|
||||||
|
results.push({ network: 'un', file: copyUnityInput(opts), ok: true });
|
||||||
|
} catch (e: any) {
|
||||||
|
results.push({ network: 'un', file: '', ok: false, error: e.message });
|
||||||
|
}
|
||||||
for (const network of opts.networks) {
|
for (const network of opts.networks) {
|
||||||
try {
|
try {
|
||||||
const filePath = await convertNetwork(html, opts, network);
|
const filePath = await convertNetwork(html, opts, network);
|
||||||
@@ -94,24 +99,25 @@ export function openPlayworksConverter(_context: vscode.ExtensionContext) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZIPPED_NETWORKS = new Set(['gg', 'vu', 'mtg']);
|
const ZIPPED_NETWORKS = new Set(['gg', 'ap', 'vu', 'mtg']);
|
||||||
const SUPPORTED_NETWORKS = new Set(['al', 'is', 'fb', 'gg', 'mo', 'vu', 'mtg', 'un', 'tt']);
|
const SUPPORTED_NETWORKS = new Set(['al', 'is', 'fb', 'gg', 'ap', 'mo', 'vu', 'mtg', 'tt']);
|
||||||
const MRAID_NETWORKS = new Set(['al', 'is', 'un']);
|
const MRAID_NETWORKS = new Set(['al', 'is']);
|
||||||
|
const EXITAPI_NETWORKS = new Set(['gg', 'ap']);
|
||||||
const NETWORK_OUTPUT_FOLDERS: Record<string, string> = {
|
const NETWORK_OUTPUT_FOLDERS: Record<string, string> = {
|
||||||
al: 'Applovin',
|
al: 'Applovin',
|
||||||
is: 'Ironsource',
|
is: 'Ironsource',
|
||||||
fb: 'Facebook',
|
fb: 'Facebook',
|
||||||
gg: 'GoogleAds',
|
gg: 'GoogleAds',
|
||||||
|
ap: 'Appreciate',
|
||||||
mo: 'Moloco',
|
mo: 'Moloco',
|
||||||
vu: 'Vungle',
|
vu: 'Vungle',
|
||||||
mtg: 'Mintegral',
|
mtg: 'Mintegral',
|
||||||
un: 'Unity',
|
|
||||||
tt: 'TikTok',
|
tt: 'TikTok',
|
||||||
};
|
};
|
||||||
|
|
||||||
function sourceBaseName(sourcePath: string): string {
|
function sourceBaseName(sourcePath: string): string {
|
||||||
return path.basename(sourcePath, path.extname(sourcePath))
|
return path.basename(sourcePath, path.extname(sourcePath))
|
||||||
.replace(/_(?:un|al|is|fb|gg|mo|vu|mtg|tt)$/, '');
|
.replace(/_(?:un|al|is|fb|gg|ap|mo|vu|mtg|tt)$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputBaseName(opts: ConvertOptions): string {
|
function outputBaseName(opts: ConvertOptions): string {
|
||||||
@@ -149,6 +155,18 @@ async function convertNetwork(html: string, opts: ConvertOptions, network: strin
|
|||||||
return outPath;
|
return outPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyUnityInput(opts: ConvertOptions): string {
|
||||||
|
const baseName = outputBaseName(opts);
|
||||||
|
const outputDir = path.join(opts.outputDir, 'Unity');
|
||||||
|
const outPath = path.join(outputDir, `${baseName}_un.html`);
|
||||||
|
fs.mkdirSync(outputDir, { recursive: true });
|
||||||
|
if (path.resolve(opts.sourcePath) === path.resolve(outPath)) {
|
||||||
|
return outPath;
|
||||||
|
}
|
||||||
|
fs.copyFileSync(opts.sourcePath, outPath);
|
||||||
|
return outPath;
|
||||||
|
}
|
||||||
|
|
||||||
function transformHtml(html: string, network: string): string {
|
function transformHtml(html: string, network: string): string {
|
||||||
let result = sanitizePlayworksHtml(html);
|
let result = sanitizePlayworksHtml(html);
|
||||||
|
|
||||||
@@ -159,7 +177,7 @@ function transformHtml(html: string, network: string): string {
|
|||||||
let headInject = buildLifecycleScript();
|
let headInject = buildLifecycleScript();
|
||||||
if (MRAID_NETWORKS.has(network)) {
|
if (MRAID_NETWORKS.has(network)) {
|
||||||
headInject += '<script src="mraid.js"></script>' + buildMraidComplianceScript();
|
headInject += '<script src="mraid.js"></script>' + buildMraidComplianceScript();
|
||||||
} else if (network === 'gg') {
|
} else if (EXITAPI_NETWORKS.has(network)) {
|
||||||
headInject += '<script src="exitapi.js"></script>';
|
headInject += '<script src="exitapi.js"></script>';
|
||||||
}
|
}
|
||||||
result = injectBeforeHeadClose(result, headInject);
|
result = injectBeforeHeadClose(result, headInject);
|
||||||
@@ -205,7 +223,7 @@ function trimAfterFirstHtmlClose(html: string): string {
|
|||||||
function finalizeNetworkHtml(html: string, network: string): string {
|
function finalizeNetworkHtml(html: string, network: string): string {
|
||||||
let result = cleanupPlayworksHtml(html);
|
let result = cleanupPlayworksHtml(html);
|
||||||
result = dedupeScriptSrc(result, 'mraid.js', MRAID_NETWORKS.has(network));
|
result = dedupeScriptSrc(result, 'mraid.js', MRAID_NETWORKS.has(network));
|
||||||
result = dedupeScriptSrc(result, 'exitapi.js', network === 'gg');
|
result = dedupeScriptSrc(result, 'exitapi.js', EXITAPI_NETWORKS.has(network));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +367,6 @@ function buildCTAScript(network: string): string {
|
|||||||
switch (network) {
|
switch (network) {
|
||||||
case 'al':
|
case 'al':
|
||||||
case 'is':
|
case 'is':
|
||||||
case 'un':
|
|
||||||
// MRAID — mraid.js injected in <head>
|
// MRAID — mraid.js injected in <head>
|
||||||
ctaLogic = `${closeCall}if(typeof mraid!=="undefined"&&typeof mraid.open==="function"){var s=typeof mraid.getState==="function"?mraid.getState():"default";if(s!=="loading"){mraid.open(o);return;}}window.open(o,"_blank");`;
|
ctaLogic = `${closeCall}if(typeof mraid!=="undefined"&&typeof mraid.open==="function"){var s=typeof mraid.getState==="function"?mraid.getState():"default";if(s!=="loading"){mraid.open(o);return;}}window.open(o,"_blank");`;
|
||||||
break;
|
break;
|
||||||
@@ -357,6 +374,7 @@ function buildCTAScript(network: string): string {
|
|||||||
ctaLogic = `${closeCall}if(typeof FbPlayableAd!=="undefined"&&typeof FbPlayableAd.onCTAClick==="function"){FbPlayableAd.onCTAClick();return;}window.open(o,"_blank");`;
|
ctaLogic = `${closeCall}if(typeof FbPlayableAd!=="undefined"&&typeof FbPlayableAd.onCTAClick==="function"){FbPlayableAd.onCTAClick();return;}window.open(o,"_blank");`;
|
||||||
break;
|
break;
|
||||||
case 'gg':
|
case 'gg':
|
||||||
|
case 'ap':
|
||||||
// Google — exitapi.js injected in <head>
|
// Google — exitapi.js injected in <head>
|
||||||
ctaLogic = `${closeCall}if(typeof ExitApi!=="undefined"&&typeof ExitApi.exit==="function"){ExitApi.exit();return;}window.open(o,"_blank");`;
|
ctaLogic = `${closeCall}if(typeof ExitApi!=="undefined"&&typeof ExitApi.exit==="function"){ExitApi.exit();return;}window.open(o,"_blank");`;
|
||||||
break;
|
break;
|
||||||
@@ -418,10 +436,10 @@ function getHtml(): string {
|
|||||||
{ tag: 'is', label: 'Ironsource', note: 'HTML + mraid.js in head' },
|
{ tag: 'is', label: 'Ironsource', note: 'HTML + mraid.js in head' },
|
||||||
{ tag: 'fb', label: 'Facebook', note: 'HTML' },
|
{ tag: 'fb', label: 'Facebook', note: 'HTML' },
|
||||||
{ tag: 'gg', label: 'Google Ads', note: 'ZIP + exitapi.js in head' },
|
{ tag: 'gg', label: 'Google Ads', note: 'ZIP + exitapi.js in head' },
|
||||||
|
{ tag: 'ap', label: 'Appreciate', note: 'ZIP + exitapi.js in head' },
|
||||||
{ tag: 'mo', label: 'Moloco', note: 'HTML + FbPlayableAd CTA' },
|
{ tag: 'mo', label: 'Moloco', note: 'HTML + FbPlayableAd CTA' },
|
||||||
{ tag: 'vu', label: 'Vungle', note: 'ZIP + __VUNGLE__ flag' },
|
{ tag: 'vu', label: 'Vungle', note: 'ZIP + __VUNGLE__ flag' },
|
||||||
{ tag: 'mtg', label: 'Mintegral', note: 'ZIP + onload="gameReady()"' },
|
{ tag: 'mtg', label: 'Mintegral', note: 'ZIP + onload="gameReady()"' },
|
||||||
{ tag: 'un', label: 'Unity', note: 'HTML + mraid.js in head' },
|
|
||||||
{ tag: 'tt', label: 'TikTok', note: 'HTML + __TIKTOK__ flag' },
|
{ tag: 'tt', label: 'TikTok', note: 'HTML + __TIKTOK__ flag' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -79,10 +79,10 @@ func PlayworksPage(w http.ResponseWriter, r *http.Request) {
|
|||||||
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="is" checked /><span class="net-label">Ironsource <span class="net-tag">is</span></span><span class="net-note">HTML + mraid.js in head</span></label>
|
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="is" checked /><span class="net-label">Ironsource <span class="net-tag">is</span></span><span class="net-note">HTML + mraid.js in head</span></label>
|
||||||
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="fb" checked /><span class="net-label">Facebook <span class="net-tag">fb</span></span><span class="net-note">HTML</span></label>
|
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="fb" checked /><span class="net-label">Facebook <span class="net-tag">fb</span></span><span class="net-note">HTML</span></label>
|
||||||
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="gg" checked /><span class="net-label">Google Ads <span class="net-tag">gg</span></span><span class="net-note">ZIP + exitapi.js in head</span></label>
|
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="gg" checked /><span class="net-label">Google Ads <span class="net-tag">gg</span></span><span class="net-note">ZIP + exitapi.js in head</span></label>
|
||||||
|
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="ap" checked /><span class="net-label">Appreciate <span class="net-tag">ap</span></span><span class="net-note">ZIP + exitapi.js in head</span></label>
|
||||||
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="mo" checked /><span class="net-label">Moloco <span class="net-tag">mo</span></span><span class="net-note">HTML + FbPlayableAd CTA</span></label>
|
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="mo" checked /><span class="net-label">Moloco <span class="net-tag">mo</span></span><span class="net-note">HTML + FbPlayableAd CTA</span></label>
|
||||||
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="vu" checked /><span class="net-label">Vungle <span class="net-tag">vu</span></span><span class="net-note">ZIP + __VUNGLE__ flag</span></label>
|
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="vu" checked /><span class="net-label">Vungle <span class="net-tag">vu</span></span><span class="net-note">ZIP + __VUNGLE__ flag</span></label>
|
||||||
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="mtg" checked /><span class="net-label">Mintegral <span class="net-tag">mtg</span></span><span class="net-note">ZIP + onload gameReady</span></label>
|
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="mtg" checked /><span class="net-label">Mintegral <span class="net-tag">mtg</span></span><span class="net-note">ZIP + onload gameReady</span></label>
|
||||||
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="un" checked /><span class="net-label">Unity <span class="net-tag">un</span></span><span class="net-note">HTML + mraid.js in head</span></label>
|
|
||||||
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="tt" /><span class="net-label">TikTok <span class="net-tag">tt</span></span><span class="net-note">HTML + __TIKTOK__ flag</span></label>
|
<label class="net-row"><input type="checkbox" class="net-cb" data-tag="tt" /><span class="net-label">TikTok <span class="net-tag">tt</span></span><span class="net-note">HTML + __TIKTOK__ flag</span></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -218,6 +218,12 @@ func PlayworksConvert(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
results := []playworksNetworkResult{}
|
results := []playworksNetworkResult{}
|
||||||
|
unityPath, err := copyPlayworksUnityInput(data, opts)
|
||||||
|
if err != nil {
|
||||||
|
results = append(results, playworksNetworkResult{Network: "un", OK: false, Error: err.Error()})
|
||||||
|
} else {
|
||||||
|
results = append(results, playworksNetworkResult{Network: "un", File: unityPath, OK: true})
|
||||||
|
}
|
||||||
for _, network := range opts.Networks {
|
for _, network := range opts.Networks {
|
||||||
filePath, err := convertPlayworksNetwork(string(data), opts, network)
|
filePath, err := convertPlayworksNetwork(string(data), opts, network)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -229,7 +235,7 @@ func PlayworksConvert(w http.ResponseWriter, r *http.Request) {
|
|||||||
writeJSON(w, map[string]any{"results": results})
|
writeJSON(w, map[string]any{"results": results})
|
||||||
}
|
}
|
||||||
|
|
||||||
var playworksSuffixRx = regexp.MustCompile(`_(?:un|al|is|fb|gg|mo|vu|mtg|tt)$`)
|
var playworksSuffixRx = regexp.MustCompile(`_(?:un|al|is|fb|gg|ap|mo|vu|mtg|tt)$`)
|
||||||
var playworksMraidScriptRx = regexp.MustCompile(`(?i)<script\b[^>]*\bsrc\s*=\s*["']mraid\.js["'][^>]*>\s*</script>\s*`)
|
var playworksMraidScriptRx = regexp.MustCompile(`(?i)<script\b[^>]*\bsrc\s*=\s*["']mraid\.js["'][^>]*>\s*</script>\s*`)
|
||||||
var playworksExitapiScriptRx = regexp.MustCompile(`(?i)<script\b[^>]*\bsrc\s*=\s*["']exitapi\.js["'][^>]*>\s*</script>\s*`)
|
var playworksExitapiScriptRx = regexp.MustCompile(`(?i)<script\b[^>]*\bsrc\s*=\s*["']exitapi\.js["'][^>]*>\s*</script>\s*`)
|
||||||
var playworksHeadCloseRx = regexp.MustCompile(`(?i)</head>`)
|
var playworksHeadCloseRx = regexp.MustCompile(`(?i)</head>`)
|
||||||
@@ -296,6 +302,19 @@ func convertPlayworksNetwork(htmlSrc string, opts playworksConvertOptions, netwo
|
|||||||
return outPath, nil
|
return outPath, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func copyPlayworksUnityInput(data []byte, opts playworksConvertOptions) (string, error) {
|
||||||
|
baseName := playworksOutputBaseName(opts)
|
||||||
|
outputDir := filepath.Join(opts.OutputDir, "Unity")
|
||||||
|
if err := os.MkdirAll(outputDir, 0755); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
outPath := filepath.Join(outputDir, fmt.Sprintf("%s_un.html", baseName))
|
||||||
|
if err := os.WriteFile(outPath, data, 0644); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return outPath, nil
|
||||||
|
}
|
||||||
|
|
||||||
func playworksNetworkOutputFolder(network string) string {
|
func playworksNetworkOutputFolder(network string) string {
|
||||||
switch network {
|
switch network {
|
||||||
case "al":
|
case "al":
|
||||||
@@ -306,14 +325,14 @@ func playworksNetworkOutputFolder(network string) string {
|
|||||||
return "Facebook"
|
return "Facebook"
|
||||||
case "gg":
|
case "gg":
|
||||||
return "GoogleAds"
|
return "GoogleAds"
|
||||||
|
case "ap":
|
||||||
|
return "Appreciate"
|
||||||
case "mo":
|
case "mo":
|
||||||
return "Moloco"
|
return "Moloco"
|
||||||
case "vu":
|
case "vu":
|
||||||
return "Vungle"
|
return "Vungle"
|
||||||
case "mtg":
|
case "mtg":
|
||||||
return "Mintegral"
|
return "Mintegral"
|
||||||
case "un":
|
|
||||||
return "Unity"
|
|
||||||
case "tt":
|
case "tt":
|
||||||
return "TikTok"
|
return "TikTok"
|
||||||
default:
|
default:
|
||||||
@@ -322,16 +341,20 @@ func playworksNetworkOutputFolder(network string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func playworksNeedsZip(network string) bool {
|
func playworksNeedsZip(network string) bool {
|
||||||
return network == "gg" || network == "vu" || network == "mtg"
|
return network == "gg" || network == "ap" || network == "vu" || network == "mtg"
|
||||||
}
|
}
|
||||||
|
|
||||||
func playworksIsMraidNetwork(network string) bool {
|
func playworksIsMraidNetwork(network string) bool {
|
||||||
return network == "al" || network == "is" || network == "un"
|
return network == "al" || network == "is"
|
||||||
|
}
|
||||||
|
|
||||||
|
func playworksIsExitapiNetwork(network string) bool {
|
||||||
|
return network == "gg" || network == "ap"
|
||||||
}
|
}
|
||||||
|
|
||||||
func playworksIsSupportedNetwork(network string) bool {
|
func playworksIsSupportedNetwork(network string) bool {
|
||||||
switch network {
|
switch network {
|
||||||
case "al", "is", "fb", "gg", "mo", "vu", "mtg", "un", "tt":
|
case "al", "is", "fb", "gg", "ap", "mo", "vu", "mtg", "tt":
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
@@ -343,7 +366,7 @@ func transformPlayworksHTML(htmlSrc, network string) string {
|
|||||||
headInject := buildPlayworksLifecycleScript()
|
headInject := buildPlayworksLifecycleScript()
|
||||||
if playworksIsMraidNetwork(network) {
|
if playworksIsMraidNetwork(network) {
|
||||||
headInject += `<script src="mraid.js"></script>` + buildPlayworksMraidComplianceScript()
|
headInject += `<script src="mraid.js"></script>` + buildPlayworksMraidComplianceScript()
|
||||||
} else if network == "gg" {
|
} else if playworksIsExitapiNetwork(network) {
|
||||||
headInject += `<script src="exitapi.js"></script>`
|
headInject += `<script src="exitapi.js"></script>`
|
||||||
}
|
}
|
||||||
result = injectPlayworksBeforeHeadClose(result, headInject)
|
result = injectPlayworksBeforeHeadClose(result, headInject)
|
||||||
@@ -385,7 +408,7 @@ func trimPlayworksAfterFirstHTMLClose(htmlSrc string) string {
|
|||||||
func finalizePlayworksNetworkHTML(htmlSrc, network string) string {
|
func finalizePlayworksNetworkHTML(htmlSrc, network string) string {
|
||||||
result := cleanupPlayworksHTML(htmlSrc)
|
result := cleanupPlayworksHTML(htmlSrc)
|
||||||
result = dedupePlayworksScriptSrc(result, "mraid.js", playworksIsMraidNetwork(network))
|
result = dedupePlayworksScriptSrc(result, "mraid.js", playworksIsMraidNetwork(network))
|
||||||
result = dedupePlayworksScriptSrc(result, "exitapi.js", network == "gg")
|
result = dedupePlayworksScriptSrc(result, "exitapi.js", playworksIsExitapiNetwork(network))
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,11 +588,11 @@ func buildPlayworksCTAScript(network string) string {
|
|||||||
closeCall := `try{window.gameClose();}catch(e){}`
|
closeCall := `try{window.gameClose();}catch(e){}`
|
||||||
ctaLogic := closeCall + `window.open(o,"_blank");`
|
ctaLogic := closeCall + `window.open(o,"_blank");`
|
||||||
switch network {
|
switch network {
|
||||||
case "al", "is", "un":
|
case "al", "is":
|
||||||
ctaLogic = closeCall + `if(typeof mraid!=="undefined"&&typeof mraid.open==="function"){var s=typeof mraid.getState==="function"?mraid.getState():"default";if(s!=="loading"){mraid.open(o);return;}}window.open(o,"_blank");`
|
ctaLogic = closeCall + `if(typeof mraid!=="undefined"&&typeof mraid.open==="function"){var s=typeof mraid.getState==="function"?mraid.getState():"default";if(s!=="loading"){mraid.open(o);return;}}window.open(o,"_blank");`
|
||||||
case "fb":
|
case "fb":
|
||||||
ctaLogic = closeCall + `if(typeof FbPlayableAd!=="undefined"&&typeof FbPlayableAd.onCTAClick==="function"){FbPlayableAd.onCTAClick();return;}window.open(o,"_blank");`
|
ctaLogic = closeCall + `if(typeof FbPlayableAd!=="undefined"&&typeof FbPlayableAd.onCTAClick==="function"){FbPlayableAd.onCTAClick();return;}window.open(o,"_blank");`
|
||||||
case "gg":
|
case "gg", "ap":
|
||||||
ctaLogic = closeCall + `if(typeof ExitApi!=="undefined"&&typeof ExitApi.exit==="function"){ExitApi.exit();return;}window.open(o,"_blank");`
|
ctaLogic = closeCall + `if(typeof ExitApi!=="undefined"&&typeof ExitApi.exit==="function"){ExitApi.exit();return;}window.open(o,"_blank");`
|
||||||
case "mo":
|
case "mo":
|
||||||
ctaLogic = closeCall + `if(typeof FbPlayableAd!=="undefined"&&typeof FbPlayableAd.onCTAClick==="function"){FbPlayableAd.onCTAClick();return;}if(typeof window.clickTag==="string"&&window.clickTag){window.open(window.clickTag,"_blank");return;}window.open(o,"_blank");`
|
ctaLogic = closeCall + `if(typeof FbPlayableAd!=="undefined"&&typeof FbPlayableAd.onCTAClick==="function"){FbPlayableAd.onCTAClick();return;}if(typeof window.clickTag==="string"&&window.clickTag){window.open(window.clickTag,"_blank");return;}window.open(o,"_blank");`
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func TestExportPlayworksNetworksForRuntimeCheck(t *testing.T) {
|
|||||||
t.Skip("PLAYWORKS_EXPORT_DIR not set")
|
t.Skip("PLAYWORKS_EXPORT_DIR not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
sourcePath := filepath.Join("..", "aiAssets", "Playworks_UnityNetwork.html")
|
sourcePath := filepath.Join("..", "aiAssets", "DogCat3_Full.html")
|
||||||
data, err := os.ReadFile(sourcePath)
|
data, err := os.ReadFile(sourcePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("read source: %v", err)
|
t.Fatalf("read source: %v", err)
|
||||||
@@ -24,7 +24,11 @@ func TestExportPlayworksNetworksForRuntimeCheck(t *testing.T) {
|
|||||||
BaseName: "wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na",
|
BaseName: "wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, network := range []string{"al", "fb", "gg", "is", "mo", "mtg", "un", "vu"} {
|
if _, err := copyPlayworksUnityInput(data, opts); err != nil {
|
||||||
|
t.Fatalf("copy unity input: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, network := range []string{"al", "ap", "fb", "gg", "is", "mo", "mtg", "vu"} {
|
||||||
if _, err := convertPlayworksNetwork(string(data), opts, network); err != nil {
|
if _, err := convertPlayworksNetwork(string(data), opts, network); err != nil {
|
||||||
t.Fatalf("convert %s: %v", network, err)
|
t.Fatalf("convert %s: %v", network, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestTransformPlayworksHTMLNetworkRequirements(t *testing.T) {
|
func TestTransformPlayworksHTMLNetworkRequirements(t *testing.T) {
|
||||||
sourcePath := filepath.Join("..", "aiAssets", "Playworks_UnityNetwork.html")
|
sourcePath := filepath.Join("..", "aiAssets", "DogCat3_Full.html")
|
||||||
data, err := os.ReadFile(sourcePath)
|
data, err := os.ReadFile(sourcePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("read source: %v", err)
|
t.Fatalf("read source: %v", err)
|
||||||
@@ -21,8 +21,8 @@ func TestTransformPlayworksHTMLNetworkRequirements(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{network: "al", wantMraid: 1},
|
{network: "al", wantMraid: 1},
|
||||||
{network: "is", wantMraid: 1},
|
{network: "is", wantMraid: 1},
|
||||||
{network: "un", wantMraid: 1},
|
|
||||||
{network: "gg", wantExitapi: 1},
|
{network: "gg", wantExitapi: 1},
|
||||||
|
{network: "ap", wantExitapi: 1},
|
||||||
{network: "fb"},
|
{network: "fb"},
|
||||||
{network: "mo"},
|
{network: "mo"},
|
||||||
{network: "vu"},
|
{network: "vu"},
|
||||||
|
|||||||
Reference in New Issue
Block a user