diff --git a/__pycache__/generate.cpython-311.pyc b/__pycache__/generate.cpython-311.pyc new file mode 100644 index 0000000..bdda059 Binary files /dev/null and b/__pycache__/generate.cpython-311.pyc differ diff --git a/generate.py b/generate.py index f36aaaa..06f5089 100644 --- a/generate.py +++ b/generate.py @@ -204,9 +204,12 @@ def generate_patched(online=True): let response2; if(navigator.onLine) { response2 = fetch(event.request).then(response => { - caches.open('v1').then(cache => { - cache.put(event.request, response.clone()); - }); + let statuscode = response.status; + if(statuscode == 200) { + caches.open('v1').then(cache => { + cache.put(event.request, response.clone()); + }); + } return response.clone(); }); } diff --git a/generate_offline.py b/generate_offline.py index fd5ac0c..4924a72 100644 --- a/generate_offline.py +++ b/generate_offline.py @@ -13,24 +13,6 @@ def get_all_files_to_offline(): return files_in_www -tivarslib = "" - -offline_file = tivarslib+""" -""" +let oldImage = Image.prototype.constructor; +Image.prototype.constructor = function(width, height) { + Object.defineProperty(this, "src", {get: function() { return this.src; }, set: function(newvalue) { this.src = get_data_by_filename(new URL(newvalue,"http://example.com/")); }}) + return oldImage(width, height); +} + + +afterload(); +function afterload() { +"""+open("www/TIVarsLib.js").read().replace("import.meta.url", "\"http://example.com/\"").replace("export default TIVarsLib;", "window.lib = TIVarsLib();")+" }" offline_file += generate_offline() diff --git a/offline.html b/offline.html deleted file mode 100644 index 80857a6..0000000 --- a/offline.html +++ /dev/null @@ -1,669 +0,0 @@ - - - - - - - TI Connect CE App for Chrome OS - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
{{connect.currentDevice.name}}
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -