Compare commits
No commits in common. "15600ceac52acfbed3530bb89485198b9ea650e5" and "2fb2a2f1833128550b6c3e2877f36e37b867afc0" have entirely different histories.
15600ceac5
...
2fb2a2f183
33
.github/workflows/release.yml
vendored
33
.github/workflows/release.yml
vendored
@ -1,33 +0,0 @@
|
|||||||
name: Create Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Get version from tag
|
|
||||||
id: get_version
|
|
||||||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
|
|
||||||
|
|
||||||
- name: Read CHANGELOG.md
|
|
||||||
id: changelog
|
|
||||||
run: |
|
|
||||||
CHANGELOG=$(awk "/## \[${{ steps.get_version.outputs.VERSION }}\]/{p=1;print;next} /## \[/{p=0} p" CHANGELOG.md)
|
|
||||||
echo "::set-output name=CHANGES::$CHANGELOG"
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{ github.ref }}
|
|
||||||
release_name: Release ${{ steps.get_version.outputs.VERSION }}
|
|
||||||
body: ${{ steps.changelog.outputs.CHANGES }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
14
CHANGELOG.md
14
CHANGELOG.md
@ -1,14 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
## [1.0.2] - 2025-02-16
|
|
||||||
### Added
|
|
||||||
- Feature 1
|
|
||||||
- Feature 2
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Change 1
|
|
||||||
- Change 2
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix 1
|
|
||||||
- Fix 2
|
|
@ -14,7 +14,7 @@ def copy_file(input_file, output_file):
|
|||||||
|
|
||||||
def should_compress(file):
|
def should_compress(file):
|
||||||
# Komprimiere nur bestimmte Dateitypen
|
# Komprimiere nur bestimmte Dateitypen
|
||||||
return file.endswith(('.js', '.png', '.css', '.html'))
|
return file.endswith(('.js', '.png', '.css'))
|
||||||
|
|
||||||
def main(source_dir, target_dir):
|
def main(source_dir, target_dir):
|
||||||
for root, dirs, files in os.walk(source_dir):
|
for root, dirs, files in os.walk(source_dir):
|
@ -12,7 +12,7 @@
|
|||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||||
<div class="logo-text">
|
<div class="logo-text">
|
||||||
<h1>FilaMan<span class="version">v1.0.2</span></h1>
|
<h1>FilaMan</h1>
|
||||||
<h4>Filament Management Tool</h4>
|
<h4>Filament Management Tool</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -32,4 +32,3 @@
|
|||||||
<div class="ram-status" id="ramStatus"></div>
|
<div class="ram-status" id="ramStatus"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,39 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
{{header}}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>FilaMan - Filament Management Tool</title>
|
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
||||||
<link rel="stylesheet" href="style.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="navbar">
|
|
||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
|
||||||
<div class="logo-text">
|
|
||||||
<h1>FilaMan<span class="version">v1.0.2</span></h1>
|
|
||||||
<h4>Filament Management Tool</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<nav style="display: flex; gap: 1rem;">
|
|
||||||
<a href="/">Start</a>
|
|
||||||
<a href="/waage">Scale</a>
|
|
||||||
<a href="/spoolman">Spoolman/Bambu</a>
|
|
||||||
<a href="/about">About</a>
|
|
||||||
</nav>
|
|
||||||
<div class="status-container">
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="bambuDot"></span>B
|
|
||||||
</div>
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="spoolmanDot"></span>S
|
|
||||||
</div>
|
|
||||||
<div class="ram-status" id="ramStatus"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>FilaMan</h1>
|
<h1>FilaMan</h1>
|
||||||
|
@ -1,39 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
{{header}}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>FilaMan - Filament Management Tool</title>
|
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
||||||
<link rel="stylesheet" href="style.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="navbar">
|
|
||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
|
||||||
<div class="logo-text">
|
|
||||||
<h1>FilaMan<span class="version">v1.0.2</span></h1>
|
|
||||||
<h4>Filament Management Tool</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<nav style="display: flex; gap: 1rem;">
|
|
||||||
<a href="/">Start</a>
|
|
||||||
<a href="/waage">Scale</a>
|
|
||||||
<a href="/spoolman">Spoolman/Bambu</a>
|
|
||||||
<a href="/about">About</a>
|
|
||||||
</nav>
|
|
||||||
<div class="status-container">
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="bambuDot"></span>B
|
|
||||||
</div>
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="spoolmanDot"></span>S
|
|
||||||
</div>
|
|
||||||
<div class="ram-status" id="ramStatus"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="connection-status hidden">
|
<div class="connection-status hidden">
|
||||||
<div class="spinner"></div>
|
<div class="spinner"></div>
|
||||||
<span>Connection lost. Trying to reconnect...</span>
|
<span>Connection lost. Trying to reconnect...</span>
|
||||||
|
@ -1,39 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
{{header}}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>FilaMan - Filament Management Tool</title>
|
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
||||||
<link rel="stylesheet" href="style.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="navbar">
|
|
||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
|
||||||
<div class="logo-text">
|
|
||||||
<h1>FilaMan<span class="version">v1.0.2</span></h1>
|
|
||||||
<h4>Filament Management Tool</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<nav style="display: flex; gap: 1rem;">
|
|
||||||
<a href="/">Start</a>
|
|
||||||
<a href="/waage">Scale</a>
|
|
||||||
<a href="/spoolman">Spoolman/Bambu</a>
|
|
||||||
<a href="/about">About</a>
|
|
||||||
</nav>
|
|
||||||
<div class="status-container">
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="bambuDot"></span>B
|
|
||||||
</div>
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="spoolmanDot"></span>S
|
|
||||||
</div>
|
|
||||||
<div class="ram-status" id="ramStatus"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
if (spoolmanUrl && spoolmanUrl.trim() !== "") {
|
if (spoolmanUrl && spoolmanUrl.trim() !== "") {
|
||||||
|
@ -1007,10 +1007,3 @@ input[type="submit"]:disabled,
|
|||||||
.spool-button:hover {
|
.spool-button:hover {
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version {
|
|
||||||
font-size: 0.4em;
|
|
||||||
color: #000;
|
|
||||||
vertical-align: middle;
|
|
||||||
margin-left: 0.5rem;
|
|
||||||
}
|
|
@ -1,39 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
{{header}}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>FilaMan - Filament Management Tool</title>
|
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
||||||
<link rel="stylesheet" href="style.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="navbar">
|
|
||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
|
||||||
<div class="logo-text">
|
|
||||||
<h1>FilaMan<span class="version">v1.0.2</span></h1>
|
|
||||||
<h4>Filament Management Tool</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<nav style="display: flex; gap: 1rem;">
|
|
||||||
<a href="/">Start</a>
|
|
||||||
<a href="/waage">Scale</a>
|
|
||||||
<a href="/spoolman">Spoolman/Bambu</a>
|
|
||||||
<a href="/about">About</a>
|
|
||||||
</nav>
|
|
||||||
<div class="status-container">
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="bambuDot"></span>B
|
|
||||||
</div>
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="spoolmanDot"></span>S
|
|
||||||
</div>
|
|
||||||
<div class="ram-status" id="ramStatus"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h1>Scale Configuration Page</h1>
|
<h1>Scale Configuration Page</h1>
|
||||||
|
|
||||||
|
@ -1,39 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
{{header}}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>FilaMan - Filament Management Tool</title>
|
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
||||||
<link rel="stylesheet" href="style.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="navbar">
|
|
||||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
|
||||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
|
||||||
<div class="logo-text">
|
|
||||||
<h1>FilaMan<span class="version">v1.0.2</span></h1>
|
|
||||||
<h4>Filament Management Tool</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<nav style="display: flex; gap: 1rem;">
|
|
||||||
<a href="/">Start</a>
|
|
||||||
<a href="/waage">Scale</a>
|
|
||||||
<a href="/spoolman">Spoolman/Bambu</a>
|
|
||||||
<a href="/about">About</a>
|
|
||||||
</nav>
|
|
||||||
<div class="status-container">
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="bambuDot"></span>B
|
|
||||||
</div>
|
|
||||||
<div class="status-item">
|
|
||||||
<span class="status-dot" id="spoolmanDot"></span>S
|
|
||||||
</div>
|
|
||||||
<div class="ram-status" id="ramStatus"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h1>WiFi Configuration Page</h1>
|
<h1>WiFi Configuration Page</h1>
|
||||||
<form action="/setToken" method="post">
|
<form action="/setToken" method="post">
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
; Please visit documentation for the other options and examples
|
; Please visit documentation for the other options and examples
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[common]
|
|
||||||
version = "1.0.2"
|
|
||||||
|
|
||||||
[env:esp32dev]
|
[env:esp32dev]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
@ -40,12 +37,7 @@ build_flags =
|
|||||||
-fdata-sections
|
-fdata-sections
|
||||||
-DNDEBUG
|
-DNDEBUG
|
||||||
-mtext-section-literals
|
-mtext-section-literals
|
||||||
'-D VERSION="${common.version}"'
|
|
||||||
|
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
pre:scripts/combine_html.py
|
pre:gzip_files.py
|
||||||
pre:scripts/pre_build.py
|
pre:extra_script.py
|
||||||
pre:scripts/pre_spiffs.py
|
|
||||||
pre:scripts/gzip_files.py
|
|
||||||
pre:scripts/extra_script.py
|
|
||||||
pre:scripts/update_changelog.py
|
|
||||||
|
60
release.sh
60
release.sh
@ -1,60 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Get version from platformio.ini
|
|
||||||
VERSION=$(grep '^version = ' platformio.ini | sed 's/version = "\(.*\)"/\1/')
|
|
||||||
|
|
||||||
if [ -z "$VERSION" ]; then
|
|
||||||
echo "Error: Could not find version in platformio.ini"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Creating release for version $VERSION"
|
|
||||||
|
|
||||||
# Check if working directory is clean
|
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
|
||||||
echo "Error: Working directory is not clean. Please commit all changes first."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Push to origin (local git repo)
|
|
||||||
echo "Pushing to origin..."
|
|
||||||
git push origin
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: Failed to push to origin"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git tag "v$VERSION"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: Failed to create tag v$VERSION"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git push origin "v$VERSION"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: Failed to push tag v$VERSION to origin"
|
|
||||||
git tag -d "v$VERSION"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ask for upstream push
|
|
||||||
read -p "Do you want to push to GitHub (upstream)? (y/n) " -n 1 -r
|
|
||||||
echo
|
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
||||||
echo "Pushing to upstream (GitHub)..."
|
|
||||||
git push upstream
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: Failed to push to upstream"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git push upstream "v$VERSION"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error: Failed to push tag v$VERSION to upstream"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Successfully pushed to GitHub"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Successfully created and pushed tag v$VERSION"
|
|
||||||
echo "All operations completed"
|
|
@ -1,31 +0,0 @@
|
|||||||
Import("env")
|
|
||||||
import os
|
|
||||||
|
|
||||||
def combine_html_files(source, target, env):
|
|
||||||
html_dir = "./html"
|
|
||||||
header_file = os.path.join(html_dir, "header.html")
|
|
||||||
|
|
||||||
# Read header content
|
|
||||||
with open(header_file, 'r') as f:
|
|
||||||
header_content = f.read()
|
|
||||||
|
|
||||||
# Process all HTML files except header.html
|
|
||||||
for filename in os.listdir(html_dir):
|
|
||||||
if filename.endswith('.html') and filename != 'header.html':
|
|
||||||
file_path = os.path.join(html_dir, filename)
|
|
||||||
|
|
||||||
# Read content
|
|
||||||
with open(file_path, 'r') as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
# Replace placeholder with header content
|
|
||||||
if '{{header}}' in content:
|
|
||||||
new_content = content.replace('{{header}}', header_content)
|
|
||||||
|
|
||||||
# Write back combined content
|
|
||||||
with open(file_path, 'w') as f:
|
|
||||||
f.write(new_content)
|
|
||||||
print(f"Combined header with {filename}")
|
|
||||||
|
|
||||||
# Register the script to run before building SPIFFS
|
|
||||||
env.AddPreAction("buildfs", combine_html_files)
|
|
@ -1,25 +0,0 @@
|
|||||||
Import("env")
|
|
||||||
import os
|
|
||||||
|
|
||||||
def replace_version(source, target, env):
|
|
||||||
# Get version from common section
|
|
||||||
version = env.GetProjectConfig().get("common", "version").strip('"')
|
|
||||||
header_file = "./html/header.html"
|
|
||||||
|
|
||||||
with open(header_file, 'r') as file:
|
|
||||||
content = file.read()
|
|
||||||
|
|
||||||
# Replace version in header.html using string manipulation instead of regex
|
|
||||||
search = '<h1>FilaMan<span class="version">v'
|
|
||||||
end = '</span>'
|
|
||||||
start_pos = content.find(search)
|
|
||||||
if start_pos != -1:
|
|
||||||
start_pos += len(search)
|
|
||||||
end_pos = content.find(end, start_pos)
|
|
||||||
if end_pos != -1:
|
|
||||||
content = content[:start_pos] + version + content[end_pos:]
|
|
||||||
|
|
||||||
with open(header_file, 'w') as file:
|
|
||||||
file.write(content)
|
|
||||||
|
|
||||||
env.AddPreAction("buildfs", replace_version)
|
|
@ -1,7 +0,0 @@
|
|||||||
Import("env")
|
|
||||||
|
|
||||||
# Wiederverwendung der replace_version Funktion
|
|
||||||
exec(open("./scripts/pre_build.py").read())
|
|
||||||
|
|
||||||
# Bind to SPIFFS build
|
|
||||||
env.AddPreAction("buildfs", replace_version)
|
|
@ -1,36 +0,0 @@
|
|||||||
import os
|
|
||||||
import re
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
def get_version():
|
|
||||||
with open('../platformio.ini', 'r') as f:
|
|
||||||
content = f.read()
|
|
||||||
version_match = re.search(r'version\s*=\s*"([^"]+)"', content)
|
|
||||||
return version_match.group(1) if version_match else None
|
|
||||||
|
|
||||||
def update_changelog():
|
|
||||||
version = get_version()
|
|
||||||
today = datetime.now().strftime('%Y-%m-%d')
|
|
||||||
|
|
||||||
changelog_template = f"""## [{version}] - {today}
|
|
||||||
### Added
|
|
||||||
-
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
-
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
-
|
|
||||||
"""
|
|
||||||
|
|
||||||
with open('../CHANGELOG.md', 'r') as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
# Insert new version template after the header
|
|
||||||
updated_content = content.replace("# Changelog\n", f"# Changelog\n\n{changelog_template}")
|
|
||||||
|
|
||||||
with open('../CHANGELOG.md', 'w') as f:
|
|
||||||
f.write(updated_content)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
update_changelog()
|
|
@ -92,16 +92,24 @@ void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventTyp
|
|||||||
|
|
||||||
// Funktion zum Laden und Ersetzen des Headers in einer HTML-Datei
|
// Funktion zum Laden und Ersetzen des Headers in einer HTML-Datei
|
||||||
String loadHtmlWithHeader(const char* filename) {
|
String loadHtmlWithHeader(const char* filename) {
|
||||||
Serial.println("Lade HTML-Datei: " + String(filename));
|
if (!SPIFFS.exists(filename) || !SPIFFS.exists("/header.html")) {
|
||||||
if (!SPIFFS.exists(filename)) {
|
|
||||||
Serial.println("Fehler: Datei nicht gefunden!");
|
Serial.println("Fehler: Datei nicht gefunden!");
|
||||||
return "Fehler: Datei nicht gefunden!";
|
return "Fehler: Datei nicht gefunden!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lade den Header
|
||||||
|
File headerFile = SPIFFS.open("/header.html", "r");
|
||||||
|
String header = headerFile.readString();
|
||||||
|
headerFile.close();
|
||||||
|
|
||||||
|
// Lade die Hauptdatei
|
||||||
File file = SPIFFS.open(filename, "r");
|
File file = SPIFFS.open(filename, "r");
|
||||||
String html = file.readString();
|
String html = file.readString();
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
// Ersetze den Platzhalter mit dem Header
|
||||||
|
html.replace("{{header}}", header);
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,31 +169,25 @@ void setupWebserver(AsyncWebServer &server) {
|
|||||||
Serial.print("Geladene Spoolman-URL: ");
|
Serial.print("Geladene Spoolman-URL: ");
|
||||||
Serial.println(spoolmanUrl);
|
Serial.println(spoolmanUrl);
|
||||||
|
|
||||||
// Route für about
|
// Route für die Startseite
|
||||||
server.on("/about", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/about", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
Serial.println("Anfrage für /about erhalten");
|
Serial.println("Anfrage für / erhalten");
|
||||||
AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/about.html.gz", "text/html");
|
String html = loadHtmlWithHeader("/index.html");
|
||||||
response->addHeader("Content-Encoding", "gzip");
|
request->send(200, "text/html", html);
|
||||||
response->addHeader("Cache-Control", CACHE_CONTROL);
|
|
||||||
request->send(response);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Route für Waage
|
// Route für Waage
|
||||||
server.on("/waage", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/waage", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
Serial.println("Anfrage für /waage erhalten");
|
Serial.println("Anfrage für /waage erhalten");
|
||||||
AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/waage.html.gz", "text/html");
|
String html = loadHtmlWithHeader("/waage.html");
|
||||||
response->addHeader("Content-Encoding", "gzip");
|
request->send(200, "text/html", html);
|
||||||
response->addHeader("Cache-Control", CACHE_CONTROL);
|
|
||||||
request->send(response);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Route für RFID
|
// Route für RFID
|
||||||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
Serial.println("Anfrage für /rfid erhalten");
|
Serial.println("Anfrage für /rfid erhalten");
|
||||||
AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/rfid.html.gz", "text/html");
|
String html = loadHtmlWithHeader("/rfid.html");
|
||||||
response->addHeader("Content-Encoding", "gzip");
|
request->send(200, "text/html", html);
|
||||||
response->addHeader("Cache-Control", CACHE_CONTROL);
|
|
||||||
request->send(response);
|
|
||||||
Serial.println("RFID-Seite gesendet");
|
Serial.println("RFID-Seite gesendet");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -209,10 +211,8 @@ void setupWebserver(AsyncWebServer &server) {
|
|||||||
// Route für WiFi
|
// Route für WiFi
|
||||||
server.on("/wifi", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/wifi", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
Serial.println("Anfrage für /wifi erhalten");
|
Serial.println("Anfrage für /wifi erhalten");
|
||||||
AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/wifi.html.gz", "text/html");
|
String html = loadHtmlWithHeader("/wifi.html");
|
||||||
response->addHeader("Content-Encoding", "gzip");
|
request->send(200, "text/html", html);
|
||||||
response->addHeader("Cache-Control", CACHE_CONTROL);
|
|
||||||
request->send(response);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Route für Spoolman Setting
|
// Route für Spoolman Setting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user