Преглед изворни кода

add `mod.php` as output for `BuildModFiles.py`

Stephan Fuchs пре 2 месеци
родитељ
комит
4b18c285ee
1 измењених фајлова са 6 додато и 2 уклоњено
  1. 6 2
      mods/util/BuildModFiles.py

+ 6 - 2
mods/util/BuildModFiles.py

@@ -8,7 +8,8 @@ import sys
 modTag = "mod"
 
 file_path_html = 'glife.html'
-file_path_mod = 'mods/mod.html'
+file_path_mod = 'mod.html'
+file_path_mod_online = 'mod.php'
 
 data = ''
 modData = ''
@@ -45,7 +46,10 @@ modData += scripts
 with open(file_path_mod, 'w') as file:
     file.write(modData)
 
+with open(file_path_mod_online, 'w') as file:
+    file.write(f'<?php header("Access-Control-Allow-Origin: *"); header(\'Content-type: text/javascript\'); echo($_GET[\'callback\']);?>(`{modData}\n`);')
 
-
+with open(file_path_html, 'w') as file:
+    file.write(dataWithoutModStuff)
 
 print('Done')