Compare commits
7 Commits
v0.3.2
...
919642a189
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
919642a189 | ||
|
|
3f9a043324 | ||
|
|
4ee35e6336 | ||
|
|
fc7fad9713 | ||
|
|
3b8db152b1 | ||
|
|
08e6197187 | ||
|
|
d618af3e67 |
101
.github/workflows/release.yml
vendored
Normal file
101
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
name: Build & Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
name: 🏗️ Windows Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Install NSIS
|
||||
run: sudo apt-get install -y nsis
|
||||
|
||||
- name: Install frontend dependencies
|
||||
working-directory: frontend
|
||||
run: npm ci
|
||||
|
||||
- name: Build frontend
|
||||
working-directory: frontend
|
||||
run: npm run build
|
||||
|
||||
- name: Cross-compile for Windows (amd64)
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
GOOS: windows
|
||||
GOARCH: amd64
|
||||
run: |
|
||||
go build -ldflags="-s -w -H windowsgui" -o build/bin/speiseplan.exe .
|
||||
echo "✅ Windows amd64 build complete"
|
||||
ls -lh build/bin/speiseplan.exe
|
||||
|
||||
- name: Build NSIS Installer
|
||||
working-directory: build/windows
|
||||
run: |
|
||||
makensis installer.nsi
|
||||
ls -lh Speiseplan-Setup.exe
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
name: ${{ github.ref_name }}
|
||||
draft: false
|
||||
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') }}
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
build/windows/Speiseplan-Setup.exe
|
||||
build/bin/speiseplan.exe
|
||||
|
||||
- name: Push Release to Gitea
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
TAG_NAME: ${{ github.ref_name }}
|
||||
run: |
|
||||
if [ -z "$GITEA_TOKEN" ]; then
|
||||
echo "⚠️ GITEA_TOKEN not set, skipping Gitea release"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
GITEA_API="https://git.supertoll.xyz/api/v1"
|
||||
REPO="kita-ortrand/speiseplan"
|
||||
|
||||
# Create Gitea release
|
||||
RELEASE_ID=$(curl -s -X POST "$GITEA_API/repos/$REPO/releases" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\",\"body\":\"Automatisch gebaut via GitHub Actions. Signiert.\",\"draft\":false,\"prerelease\":false}" \
|
||||
| jq -r '.id')
|
||||
|
||||
echo "Gitea Release ID: $RELEASE_ID"
|
||||
|
||||
# Upload installer to Gitea
|
||||
curl -s -X POST "$GITEA_API/repos/$REPO/releases/$RELEASE_ID/assets?name=Speiseplan-Setup.exe" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@build/windows/Speiseplan-Setup.exe"
|
||||
|
||||
# Upload standalone exe to Gitea
|
||||
curl -s -X POST "$GITEA_API/repos/$REPO/releases/$RELEASE_ID/assets?name=speiseplan.exe" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@build/bin/speiseplan.exe"
|
||||
|
||||
echo "✅ Release pushed to Gitea"
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Kita Ortrand
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
14
app.go
14
app.go
@@ -373,6 +373,20 @@ func (a *App) DownloadUpdate() (string, error) {
|
||||
return a.updater.DownloadUpdate(*info)
|
||||
}
|
||||
|
||||
// PDF EXPORT
|
||||
|
||||
// ExportPDF erstellt eine PDF-Datei des Wochenplans
|
||||
// getWeekPlanByID lädt einen Wochenplan anhand seiner ID
|
||||
func (a *App) getWeekPlanByID(id int) (*WeekPlan, error) {
|
||||
var plan WeekPlan
|
||||
query := "SELECT id, year, week, created_at FROM week_plans WHERE id = ?"
|
||||
err := db.Get(&plan, query, id)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get week plan by ID: %w", err)
|
||||
}
|
||||
return &plan, nil
|
||||
}
|
||||
|
||||
// HILFSFUNKTIONEN
|
||||
|
||||
// loadProductRelations lädt Allergene und Zusatzstoffe für ein Produkt
|
||||
|
||||
BIN
build/appicon.png
Normal file
BIN
build/appicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
BIN
build/windows/icon.ico
Normal file
BIN
build/windows/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
83
build/windows/installer.nsi
Normal file
83
build/windows/installer.nsi
Normal file
@@ -0,0 +1,83 @@
|
||||
!include "MUI2.nsh"
|
||||
|
||||
; Allgemein
|
||||
Name "Speiseplan"
|
||||
OutFile "Speiseplan-Setup.exe"
|
||||
InstallDir "$PROGRAMFILES\Speiseplan"
|
||||
InstallDirRegKey HKLM "Software\Speiseplan" "Install_Dir"
|
||||
RequestExecutionLevel admin
|
||||
|
||||
; UI
|
||||
!define MUI_ICON "icon.ico"
|
||||
!define MUI_UNICON "icon.ico"
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_WELCOMEPAGE_TITLE "Speiseplan Setup"
|
||||
!define MUI_WELCOMEPAGE_TEXT "Dieses Programm installiert den Kita-Wochenspeiseplan auf Ihrem Computer.$\r$\n$\r$\nKlicken Sie auf Weiter, um fortzufahren."
|
||||
|
||||
; Seiten
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
; Deinstallation
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
; Sprache
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
|
||||
; Hauptinstallation
|
||||
Section "Speiseplan (erforderlich)" SecMain
|
||||
SectionIn RO
|
||||
SetOutPath $INSTDIR
|
||||
File "..\..\build\bin\speiseplan.exe"
|
||||
File "icon.ico"
|
||||
|
||||
; Registry
|
||||
WriteRegStr HKLM "Software\Speiseplan" "Install_Dir" "$INSTDIR"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "DisplayName" "Speiseplan"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "DisplayIcon" "$INSTDIR\icon.ico"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "NoModify" 1
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "NoRepair" 1
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
; Startmenü
|
||||
CreateDirectory "$SMPROGRAMS\Speiseplan"
|
||||
CreateShortCut "$SMPROGRAMS\Speiseplan\Speiseplan.lnk" "$INSTDIR\speiseplan.exe" "" "$INSTDIR\icon.ico"
|
||||
CreateShortCut "$SMPROGRAMS\Speiseplan\Deinstallieren.lnk" "$INSTDIR\uninstall.exe"
|
||||
SectionEnd
|
||||
|
||||
; Desktop-Verknüpfung (optional)
|
||||
Section "Desktop-Verknüpfung" SecDesktop
|
||||
CreateShortCut "$DESKTOP\Speiseplan.lnk" "$INSTDIR\speiseplan.exe" "" "$INSTDIR\icon.ico"
|
||||
SectionEnd
|
||||
|
||||
; Komponentenbeschreibungen
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecMain} "Das Speiseplan-Programm (erforderlich)."
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "Erstellt eine Verknüpfung auf dem Desktop."
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
; Deinstallation
|
||||
Section "Uninstall"
|
||||
Delete "$INSTDIR\speiseplan.exe"
|
||||
Delete "$INSTDIR\icon.ico"
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
Delete "$SMPROGRAMS\Speiseplan\*.*"
|
||||
RMDir "$SMPROGRAMS\Speiseplan"
|
||||
Delete "$DESKTOP\Speiseplan.lnk"
|
||||
|
||||
; Datenbank löschen
|
||||
MessageBox MB_YESNO "Sollen die gespeicherten Daten (Speisepläne, Produkte) ebenfalls gelöscht werden?" IDYES deletedata IDNO skipdata
|
||||
deletedata:
|
||||
RMDir /r "$LOCALAPPDATA\Speiseplan"
|
||||
skipdata:
|
||||
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan"
|
||||
DeleteRegKey HKLM "Software\Speiseplan"
|
||||
SectionEnd
|
||||
13
db.go
13
db.go
@@ -13,13 +13,18 @@ var db *sqlx.DB
|
||||
|
||||
// InitDatabase initialisiert die SQLite-Datenbank
|
||||
func InitDatabase() error {
|
||||
// DB-Datei im User-Home-Verzeichnis
|
||||
homeDir, err := os.UserHomeDir()
|
||||
// DB-Datei in AppData/Local/Speiseplan
|
||||
configDir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get user home directory: %w", err)
|
||||
return fmt.Errorf("failed to get config directory: %w", err)
|
||||
}
|
||||
|
||||
dbPath := filepath.Join(homeDir, "speiseplan.db")
|
||||
appDir := filepath.Join(configDir, "Speiseplan")
|
||||
if err := os.MkdirAll(appDir, 0755); err != nil {
|
||||
return fmt.Errorf("failed to create app directory: %w", err)
|
||||
}
|
||||
|
||||
dbPath := filepath.Join(appDir, "speiseplan.db")
|
||||
|
||||
// Verbindung zur Datenbank herstellen
|
||||
database, err := sqlx.Open("sqlite", dbPath)
|
||||
|
||||
@@ -79,7 +79,7 @@ export function InfoPage() {
|
||||
<div>
|
||||
<dt className="text-sm font-medium text-gray-500">Version</dt>
|
||||
<dd className="mt-1 text-sm text-gray-900 font-mono">
|
||||
{updateInfo?.current_version || '1.0.0'}
|
||||
{updateInfo?.current_version || '0.4.5'}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -345,7 +345,7 @@ export function InfoPage() {
|
||||
|
||||
<div className="text-sm text-gray-600 space-y-2">
|
||||
<p>
|
||||
<strong>Version:</strong> 1.0.0 (Build 2026.02.20)
|
||||
<strong>Version:</strong> 0.4.5 (Build 2026.02.20)
|
||||
</p>
|
||||
<p>
|
||||
<strong>Support:</strong> Wenden Sie sich bei Fragen oder Problemen an Ihre IT-Abteilung
|
||||
|
||||
@@ -85,9 +85,8 @@ export function WeekPlanner({ year, week, className = '' }: WeekPlannerProps) {
|
||||
setPdfSuccess(null);
|
||||
|
||||
try {
|
||||
// ExportPDF nimmt weekPlanID und outputPath - Go-Seite öffnet Save-Dialog mit leer-string
|
||||
await ExportPDF(weekPlan.id, '');
|
||||
setPdfSuccess('PDF wurde erfolgreich erstellt.');
|
||||
const result = await ExportPDF(weekPlan.id, '');
|
||||
setPdfSuccess(result || 'PDF wurde erfolgreich erstellt.');
|
||||
|
||||
// Success-Nachricht nach 5 Sekunden ausblenden
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -19,7 +19,7 @@ export function useProducts() {
|
||||
|
||||
try {
|
||||
const productList = await GetProducts();
|
||||
setProducts(productList);
|
||||
setProducts(productList || []);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Fehler beim Laden der Produkte');
|
||||
} finally {
|
||||
@@ -35,8 +35,8 @@ export function useProducts() {
|
||||
GetAdditives()
|
||||
]);
|
||||
|
||||
setAllergens(allergenList);
|
||||
setAdditives(additiveList);
|
||||
setAllergens(allergenList || []);
|
||||
setAdditives(additiveList || []);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Fehler beim Laden der Stammdaten');
|
||||
}
|
||||
|
||||
@@ -19,6 +19,11 @@ export function useWeekPlan(year: number, week: number) {
|
||||
|
||||
try {
|
||||
const plan = await GetWeekPlan(year, week);
|
||||
// Null-Safety: Go kann null für leere Arrays zurückgeben
|
||||
if (plan) {
|
||||
plan.entries = plan.entries || [];
|
||||
plan.special_days = plan.special_days || [];
|
||||
}
|
||||
setWeekPlan(plan);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Fehler beim Laden des Wochenplans');
|
||||
@@ -35,6 +40,10 @@ export function useWeekPlan(year: number, week: number) {
|
||||
|
||||
try {
|
||||
const newPlan = await CreateWeekPlan(year, week);
|
||||
if (newPlan) {
|
||||
newPlan.entries = newPlan.entries || [];
|
||||
newPlan.special_days = newPlan.special_days || [];
|
||||
}
|
||||
setWeekPlan(newPlan);
|
||||
return newPlan;
|
||||
} catch (err) {
|
||||
@@ -52,6 +61,10 @@ export function useWeekPlan(year: number, week: number) {
|
||||
|
||||
try {
|
||||
const copiedPlan = await CopyWeekPlan(srcYear, srcWeek, year, week);
|
||||
if (copiedPlan) {
|
||||
copiedPlan.entries = copiedPlan.entries || [];
|
||||
copiedPlan.special_days = copiedPlan.special_days || [];
|
||||
}
|
||||
setWeekPlan(copiedPlan);
|
||||
return copiedPlan;
|
||||
} catch (err) {
|
||||
@@ -73,7 +86,15 @@ export function useWeekPlan(year: number, week: number) {
|
||||
if (!weekPlan) return null;
|
||||
|
||||
try {
|
||||
const newEntry = await AddPlanEntry(weekPlan.id, day, meal, productId, customText, groupLabel);
|
||||
// Go erwartet null statt undefined für optionale Pointer-Parameter
|
||||
const newEntry = await AddPlanEntry(
|
||||
weekPlan.id,
|
||||
day,
|
||||
meal,
|
||||
productId ?? null,
|
||||
customText ?? null,
|
||||
groupLabel ?? null
|
||||
);
|
||||
|
||||
// State aktualisieren
|
||||
setWeekPlan(prev => prev ? {
|
||||
@@ -114,7 +135,8 @@ export function useWeekPlan(year: number, week: number) {
|
||||
groupLabel?: GroupLabel
|
||||
): Promise<PlanEntry | null> => {
|
||||
try {
|
||||
const updatedEntry = await UpdatePlanEntry(entryId, 0, '', 0, productId ?? null, customText ?? null, groupLabel ?? null);
|
||||
// Go: UpdatePlanEntry(id int, productID *int, customText *string, groupLabel *string)
|
||||
const updatedEntry = await UpdatePlanEntry(entryId, productId ?? null, customText ?? null, groupLabel ?? null);
|
||||
|
||||
// State aktualisieren
|
||||
setWeekPlan(prev => prev ? {
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
const (
|
||||
// Aktuelle Version der App
|
||||
CurrentVersion = "1.0.0"
|
||||
CurrentVersion = "0.4.5"
|
||||
// Update-Check URL
|
||||
UpdateURL = "https://speiseplan.supertoll.xyz/version.json"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user