-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update workflows, update icons, fix Dockerfile Signed-off-by: Marcel Goerentz <m.goerentz@t-online.de>
- Loading branch information
1 parent
ea288df
commit efcfb43
Showing
21 changed files
with
606 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import os | ||
import base64 | ||
|
||
# Variablen | ||
html_folder = "./web/public" | ||
go_file = "./src/webUI.go" | ||
package_name = "src" | ||
map_name = "webUI" | ||
|
||
# Funktion zum Überprüfen der HTML-Dateien | ||
def check_html_folder(): | ||
if not os.path.isdir(html_folder): | ||
print("HTML folder does not exist.") | ||
return False | ||
return True | ||
|
||
# Funktion zum Erstellen der Go-Datei | ||
def build_go_file(): | ||
if not check_html_folder(): | ||
return | ||
|
||
content = f"package {package_name}\n\n" | ||
content += f"var {map_name} = make(map[string]interface{{}})\n\n" | ||
content += "func loadHTMLMap() {\n\n" | ||
|
||
# Hier wird die Map aus den Dateien im HTML-Ordner erstellt | ||
content += create_map_from_files(html_folder) + "\n" | ||
|
||
content += "}\n\n" | ||
|
||
with open(go_file, "w") as f: | ||
f.write(content) | ||
|
||
# Funktion zum Erstellen der Map aus den Dateien im HTML-Ordner | ||
def create_map_from_files(folder): | ||
map_content = "" | ||
for root, _, files in os.walk(folder): | ||
for file in files: | ||
file_path = os.path.join(root, file) | ||
with open(file_path, "rb") as f: | ||
base64_str = base64.b64encode(f.read()).decode('utf-8') | ||
key = os.path.relpath(file_path, folder).replace("\\", "/") | ||
map_content += f'\t{map_name}["web/public/{key}"] = "{base64_str}"\n' | ||
return map_content | ||
|
||
# Aufruf der Funktion buildGoFile | ||
build_go_file() | ||
print("Created new webUI.go") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.