playcanvas / playcanvas-rest-api-tools

A set of tools to use with the PlayCanvas REST API for common jobs such as downloading a build and archiving a project
MIT License
23 stars 7 forks source link

Add an ability to strip localStorage mentioning in the code #38

Closed flyingbaba closed 2 years ago

flyingbaba commented 2 years ago

While trying to make a valid build for Google HTML5 validator we had an issue / blocker with Advanced HTML check .

Here is the details:

One of your HTML5 assets is invalid and cannot be analyzed. Please correct any malformed assets and try again.

More details:
Source: HTML5_FEATURE_UNSUPPORTED found in playable_ad.html: localStorage

The solution: Find (CTRL + F) localStorage mentioning in the code:

image

Change to:

image

After that varification can be passed.

yaustar commented 2 years ago

Where is localStorage used in the engine/boilerplate? Or is this in the game code itself?

flyingbaba commented 2 years ago

It is in the engine.

yaustar commented 2 years ago

Hmm, I can't see it in the engine repo except for the examples which aren't part of build?

image
yaustar commented 2 years ago

I can't see it in the minified source of the engine either

image
flyingbaba commented 2 years ago

That's odd, I'll investigate more thenever I will have time for it. Meanwhile I seearched for localStorage inside projects files and found none. From the config, I have a compress_engine, patch_xhr_out and inline_game_scripts set to true. Maybe engine compressor adds this ?

yaustar commented 2 years ago

Ah yes, it is in the compressor: https://raw.githubusercontent.com/playcanvas/playcanvas-rest-api-tools/main/library-files/lz4.js

We could just modify that file to do a no-op/null instead

image