initialize generic rms-software repository
Add the reusable RMS core application (server, web UI, plugins, tests, tools) with generic defaults, GPL licensing, and maintainer context documentation so deployments can consume this repo as software source independent of station-specific overlays.
This commit is contained in:
53
tools/check-windows-paths.ps1
Normal file
53
tools/check-windows-paths.ps1
Normal file
@@ -0,0 +1,53 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[string]$RepoPath = "."
|
||||
)
|
||||
|
||||
$invalidCharPattern = '[<>:""/|?*]'
|
||||
$reserved = '^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\..*)?$'
|
||||
|
||||
$repoAbs = Resolve-Path $RepoPath
|
||||
Push-Location $repoAbs
|
||||
|
||||
try {
|
||||
$paths = git ls-tree -r --name-only HEAD
|
||||
if (-not $paths) {
|
||||
Write-Output "Keine Dateien im Git-Tree gefunden."
|
||||
exit 0
|
||||
}
|
||||
|
||||
$issues = @()
|
||||
foreach ($p in $paths) {
|
||||
$parts = $p -split '/'
|
||||
foreach ($part in $parts) {
|
||||
if ($part -match $invalidCharPattern) {
|
||||
$issues += "INVALID_CHAR: $p"
|
||||
break
|
||||
}
|
||||
if ($part -match $reserved) {
|
||||
$issues += "RESERVED_NAME: $p"
|
||||
break
|
||||
}
|
||||
if ($part.EndsWith(".") -or $part.EndsWith(" ")) {
|
||||
$issues += "TRAILING_DOT_SPACE: $p"
|
||||
break
|
||||
}
|
||||
}
|
||||
if ($p.Length -gt 245) {
|
||||
$issues += "POTENTIAL_LONG_PATH($($p.Length)): $p"
|
||||
}
|
||||
}
|
||||
|
||||
if ($issues.Count -eq 0) {
|
||||
Write-Output "Keine offensichtlichen Windows-Pfadprobleme im aktuellen Commit gefunden."
|
||||
exit 0
|
||||
}
|
||||
|
||||
$issues | Sort-Object -Unique | ForEach-Object { Write-Output $_ }
|
||||
exit 2
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
53
tools/migrate-json-to-sqlite.js
Normal file
53
tools/migrate-json-to-sqlite.js
Normal file
@@ -0,0 +1,53 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const fsp = require("fs/promises");
|
||||
|
||||
const { createJsonStorage } = require("../server/storage/providers/json");
|
||||
const { createSqliteStorage } = require("../server/storage/providers/sqlite");
|
||||
|
||||
async function main() {
|
||||
const rootDir = path.resolve(__dirname, "..");
|
||||
const dataDir = path.resolve(rootDir, process.env.DATA_DIR || "./data");
|
||||
const sqlitePath = path.resolve(rootDir, process.env.STORAGE_SQLITE_PATH || "./data/rms-storage.db");
|
||||
|
||||
await fsp.mkdir(dataDir, { recursive: true });
|
||||
|
||||
const json = createJsonStorage({ dataDir });
|
||||
await json.init();
|
||||
const sqlite = createSqliteStorage({ sqlitePath });
|
||||
await sqlite.init();
|
||||
|
||||
const files = [
|
||||
"users.json",
|
||||
"station-state.json",
|
||||
"auth-state.json",
|
||||
"plugin-state.json"
|
||||
].map((name) => path.join(dataDir, name));
|
||||
|
||||
for (const filePath of files) {
|
||||
if (!fs.existsSync(filePath)) {
|
||||
continue;
|
||||
}
|
||||
const value = await json.readJson(filePath, null);
|
||||
if (value !== null) {
|
||||
await sqlite.writeJson(filePath, value);
|
||||
console.log(`migrated json: ${filePath}`);
|
||||
}
|
||||
}
|
||||
|
||||
const auditPath = path.join(dataDir, "audit.log");
|
||||
if (fs.existsSync(auditPath)) {
|
||||
const content = await json.readText(auditPath, "");
|
||||
if (content) {
|
||||
await sqlite.writeText(auditPath, content);
|
||||
console.log(`migrated text: ${auditPath}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`done -> ${sqlitePath}`);
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error("migration failed", error);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user