Compare commits
3 Commits
2fb2a2f183
...
15600ceac5
Author | SHA1 | Date | |
---|---|---|---|
15600ceac5 | |||
7ccacec68f | |||
2f34a0ca4e |
33
.github/workflows/release.yml
vendored
Normal file
33
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
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
Normal file
14
CHANGELOG.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Changelog
|
||||
|
||||
## [1.0.2] - 2025-02-16
|
||||
### Added
|
||||
- Feature 1
|
||||
- Feature 2
|
||||
|
||||
### Changed
|
||||
- Change 1
|
||||
- Change 2
|
||||
|
||||
### Fixed
|
||||
- Fix 1
|
||||
- Fix 2
|
@ -12,7 +12,7 @@
|
||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||
<img src="/logo.png" alt="FilaMan Logo" class="logo">
|
||||
<div class="logo-text">
|
||||
<h1>FilaMan</h1>
|
||||
<h1>FilaMan<span class="version">v1.0.2</span></h1>
|
||||
<h4>Filament Management Tool</h4>
|
||||
</div>
|
||||
</div>
|
||||
@ -32,3 +32,4 @@
|
||||
<div class="ram-status" id="ramStatus"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -1,4 +1,39 @@
|
||||
{{header}}
|
||||
<!DOCTYPE html>
|
||||
<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">
|
||||
<h1>FilaMan</h1>
|
||||
|
@ -1,4 +1,39 @@
|
||||
{{header}}
|
||||
<!DOCTYPE html>
|
||||
<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="spinner"></div>
|
||||
<span>Connection lost. Trying to reconnect...</span>
|
||||
|
@ -1,4 +1,39 @@
|
||||
{{header}}
|
||||
<!DOCTYPE html>
|
||||
<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>
|
||||
window.onload = function() {
|
||||
if (spoolmanUrl && spoolmanUrl.trim() !== "") {
|
||||
|
@ -1007,3 +1007,10 @@ input[type="submit"]:disabled,
|
||||
.spool-button:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.version {
|
||||
font-size: 0.4em;
|
||||
color: #000;
|
||||
vertical-align: middle;
|
||||
margin-left: 0.5rem;
|
||||
}
|
@ -1,4 +1,39 @@
|
||||
{{header}}
|
||||
<!DOCTYPE html>
|
||||
<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">
|
||||
<h1>Scale Configuration Page</h1>
|
||||
|
||||
|
@ -1,4 +1,39 @@
|
||||
{{header}}
|
||||
<!DOCTYPE html>
|
||||
<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">
|
||||
<h1>WiFi Configuration Page</h1>
|
||||
<form action="/setToken" method="post">
|
||||
|
@ -8,6 +8,9 @@
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[common]
|
||||
version = "1.0.2"
|
||||
|
||||
[env:esp32dev]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
@ -37,7 +40,12 @@ build_flags =
|
||||
-fdata-sections
|
||||
-DNDEBUG
|
||||
-mtext-section-literals
|
||||
'-D VERSION="${common.version}"'
|
||||
|
||||
extra_scripts =
|
||||
pre:gzip_files.py
|
||||
pre:extra_script.py
|
||||
pre:scripts/combine_html.py
|
||||
pre:scripts/pre_build.py
|
||||
pre:scripts/pre_spiffs.py
|
||||
pre:scripts/gzip_files.py
|
||||
pre:scripts/extra_script.py
|
||||
pre:scripts/update_changelog.py
|
||||
|
60
release.sh
Normal file
60
release.sh
Normal file
@ -0,0 +1,60 @@
|
||||
#!/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"
|
31
scripts/combine_html.py
Normal file
31
scripts/combine_html.py
Normal file
@ -0,0 +1,31 @@
|
||||
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)
|
@ -14,7 +14,7 @@ def copy_file(input_file, output_file):
|
||||
|
||||
def should_compress(file):
|
||||
# Komprimiere nur bestimmte Dateitypen
|
||||
return file.endswith(('.js', '.png', '.css'))
|
||||
return file.endswith(('.js', '.png', '.css', '.html'))
|
||||
|
||||
def main(source_dir, target_dir):
|
||||
for root, dirs, files in os.walk(source_dir):
|
25
scripts/pre_build.py
Normal file
25
scripts/pre_build.py
Normal file
@ -0,0 +1,25 @@
|
||||
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)
|
7
scripts/pre_spiffs.py
Normal file
7
scripts/pre_spiffs.py
Normal file
@ -0,0 +1,7 @@
|
||||
Import("env")
|
||||
|
||||
# Wiederverwendung der replace_version Funktion
|
||||
exec(open("./scripts/pre_build.py").read())
|
||||
|
||||
# Bind to SPIFFS build
|
||||
env.AddPreAction("buildfs", replace_version)
|
36
scripts/update_changelog.py
Normal file
36
scripts/update_changelog.py
Normal file
@ -0,0 +1,36 @@
|
||||
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,24 +92,16 @@ void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventTyp
|
||||
|
||||
// Funktion zum Laden und Ersetzen des Headers in einer HTML-Datei
|
||||
String loadHtmlWithHeader(const char* filename) {
|
||||
if (!SPIFFS.exists(filename) || !SPIFFS.exists("/header.html")) {
|
||||
Serial.println("Lade HTML-Datei: " + String(filename));
|
||||
if (!SPIFFS.exists(filename)) {
|
||||
Serial.println("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");
|
||||
String html = file.readString();
|
||||
file.close();
|
||||
|
||||
// Ersetze den Platzhalter mit dem Header
|
||||
html.replace("{{header}}", header);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
@ -169,25 +161,31 @@ void setupWebserver(AsyncWebServer &server) {
|
||||
Serial.print("Geladene Spoolman-URL: ");
|
||||
Serial.println(spoolmanUrl);
|
||||
|
||||
// Route für die Startseite
|
||||
// Route für about
|
||||
server.on("/about", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
Serial.println("Anfrage für / erhalten");
|
||||
String html = loadHtmlWithHeader("/index.html");
|
||||
request->send(200, "text/html", html);
|
||||
Serial.println("Anfrage für /about erhalten");
|
||||
AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/about.html.gz", "text/html");
|
||||
response->addHeader("Content-Encoding", "gzip");
|
||||
response->addHeader("Cache-Control", CACHE_CONTROL);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
// Route für Waage
|
||||
server.on("/waage", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
Serial.println("Anfrage für /waage erhalten");
|
||||
String html = loadHtmlWithHeader("/waage.html");
|
||||
request->send(200, "text/html", html);
|
||||
AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/waage.html.gz", "text/html");
|
||||
response->addHeader("Content-Encoding", "gzip");
|
||||
response->addHeader("Cache-Control", CACHE_CONTROL);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
// Route für RFID
|
||||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
Serial.println("Anfrage für /rfid erhalten");
|
||||
String html = loadHtmlWithHeader("/rfid.html");
|
||||
request->send(200, "text/html", html);
|
||||
AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/rfid.html.gz", "text/html");
|
||||
response->addHeader("Content-Encoding", "gzip");
|
||||
response->addHeader("Cache-Control", CACHE_CONTROL);
|
||||
request->send(response);
|
||||
Serial.println("RFID-Seite gesendet");
|
||||
});
|
||||
|
||||
@ -211,8 +209,10 @@ void setupWebserver(AsyncWebServer &server) {
|
||||
// Route für WiFi
|
||||
server.on("/wifi", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
Serial.println("Anfrage für /wifi erhalten");
|
||||
String html = loadHtmlWithHeader("/wifi.html");
|
||||
request->send(200, "text/html", html);
|
||||
AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/wifi.html.gz", "text/html");
|
||||
response->addHeader("Content-Encoding", "gzip");
|
||||
response->addHeader("Cache-Control", CACHE_CONTROL);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
// Route für Spoolman Setting
|
||||
|
Loading…
x
Reference in New Issue
Block a user