Update to latest version

This commit is contained in:
Reditus committed 2026-05-15 02:18:17 +01:00
1 parent 7125e29993
commit c74ef9cf9c
15 files changed
+191 -70

No files matched your search

View File
Whitespace-only changes.
+5
View File
@@ -0,0 +1,5 @@
{
"workspace_id": "6c5e-09e0-3a93-f4a1",
"workspace_id_at": "2026-05-14T10:44:35Z",
"project_name": "DuneDashboard"
}
+79
View File
@@ -0,0 +1,79 @@
# SpecStory CLI Configuration
#
# This is the project-level config file for SpecStory CLI.
# All settings here apply to this project unless overridden by CLI flags.
#
# Uncomment (remove the #) the line and edit any setting below to change the default behavior.
# For more information, see: https://docs.specstory.com/integrations/terminal-coding-agents/usage
[local_sync]
# Write markdown files locally. (default: true)
# enabled = false # equivalent to --only-cloud-sync
# Custom output directory for markdown files.
# Default: ./.specstory/history (relative to the project directory)
# output_dir = "~/.specstory/history" # equivalent to --output-dir "~/.specstory/history"
# Use local timezone for file name and content timestamps (default: false, UTC)
# local_time_zone = true # equivalent to --local-time-zone
[cloud_sync]
# Sync session data to SpecStory Cloud. (default: true, when logged in to SpecStory Cloud)
# enabled = false # equivalent to --no-cloud-sync
[logging]
# Write logs to .specstory/debug/debug.log (default: false)
# log = true # equivalent to --log
# Debug-level output, requires console or log (default: false)
# debug = true # equivalent to --debug
# Custom output directory for debug data.
# Default: ./.specstory/debug (relative to the project directory)
# debug_dir = "~/.specstory/debug" # equivalent to --debug-dir "~/.specstory/debug"
# Error/warn/info output to stdout (default: false)
# console = true # equivalent to --console
# Suppress all non-error output (default: false)
# silent = true # equivalent to --silent
[version_check]
# Check for new versions of the CLI on startup.
# Default: true
# enabled = false # equivalent to --no-version-check
[analytics]
# Send anonymous product usage analytics to help improve SpecStory.
# Default: true
# enabled = false # equivalent to --no-usage-analytics
[telemetry]
# OTLP gRPC collector endpoint (e.g., "localhost:4317" or "http://localhost:4317")
# endpoint = "localhost:4317"
# Override the default service name (default: "specstory-cli")
# service_name = "my-service-name"
# Include user prompt text in telemetry spans (default: true)
# prompts = false
[providers]
# Agent execution commands by provider (used by specstory run)
# Pass custom flags (e.g. claude_cmd = "claude --allow-dangerously-skip-permissions")
# Use of these is equivalent to -c "custom command"
# Claude Code command
# claude_cmd = "claude"
# Codex CLI command
# codex_cmd = "codex"
# Cursor CLI command
# cursor_cmd = "cursor-agent"
# Droid CLI command
# droid_cmd = "droid"
# Gemini CLI command
# gemini_cmd = "gemini"
+8 -4
View File
@@ -45,8 +45,8 @@ DEFAULTS = {
'port': 18888,
},
'firewall': {
'block_filebrowser': False,
'block_director': False,
'block_filebrowser': True,
'block_director': True,
'block_postgres': True,
},
'cache': {
@@ -171,17 +171,21 @@ def load_settings(settings_path=None):
# Backward compatibility: migrate old plaintext password to hash
# This is a one-time migration that hashes the password and removes plaintext
auth = settings.get('auth', {})
password_migrated = False
if auth.get('password') and not auth.get('password_hash'):
try:
from argon2 import PasswordHasher
ph = PasswordHasher()
settings['auth']['password_hash'] = ph.hash(str(auth['password']))
# Remove plaintext after hashing
del settings['auth']['password']
password_migrated = True
logger.info("Migrated plaintext password to Argon2 hash")
except ImportError:
logger.error("argon2-cffi not installed. Password hashing unavailable.")
# Fallback: keep plaintext for now but log warning
settings['auth']['password_hash'] = None
if password_migrated:
settings['dashboard']['secret_key'] = secrets.token_hex(32)
logger.warning("Rotated secret_key to invalidate sessions after password migration")
return settings
+1 -1
View File
@@ -24,7 +24,7 @@ def init_auth(app, settings, limiter=None):
return None
@app.route('/login', methods=['GET', 'POST'])
@limiter.limit("10 per minute") if limiter else lambda f: f
@limiter.limit("5 per hour") if limiter else lambda f: f
def login():
if current_user.is_authenticated:
return redirect(url_for('overview'))
+16 -6
View File
@@ -317,14 +317,24 @@ def register_routes(app, services, settings):
def events_page():
game_events = []
event_logs = []
def safe_query(table, cols, order_col, limit):
try:
return db.query(f"SELECT {cols} FROM {table} ORDER BY {order_col} DESC LIMIT {limit}") or []
except Exception as e:
logger.error(f"Error fetching {table}: {e}")
return []
try:
game_events = db.query("SELECT id, event_type, actor_id, actor_name, map, universe_time, x, y, z FROM dune.game_events ORDER BY universe_time DESC LIMIT 50") or []
except Exception as e:
logger.error(f"Error fetching game_events: {e}")
game_events = safe_query("dune.game_events", "*", "universe_time", 50)
except Exception:
pass
try:
event_logs = db.query("SELECT id, event_type, category, function_name, message, event_time, meta FROM dune.event_log ORDER BY event_time DESC LIMIT 100") or []
except Exception as e:
logger.error(f"Error fetching event_logs: {e}")
event_logs = safe_query("dune.event_log", "*", "event_time", 100)
except Exception:
pass
return render_template('events.html', game_events=game_events, event_logs=event_logs)
# Chat
+45 -11
View File
@@ -167,22 +167,56 @@ $FileBrowserPort = "18888"
$AuthUser = "admin"
$AuthPass = ""
# Try to detect VM IP from known_hosts
$KnownHosts = Join-Path $env:USERPROFILE ".ssh\known_hosts"
if (Test-Path $KnownHosts) {
$content = Get-Content $KnownHosts
$ips = @()
foreach ($line in $content) {
if ($line -match '\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b') {
$ips += $matches[1]
# Try to detect VM IP - prioritize local Hyper-V, then local network IPs from known_hosts
function Test-IsLocalIP($ip) {
if ($ip -match '^192\.168\.') { return $true }
if ($ip -match '^10\.') { return $true }
if ($ip -match '^172\.(1[6-9]|2[0-9]|3[0-1])\.') { return $true }
return $false
}
# First: try direct Hyper-V detection
$vmIp = $null
try {
$vmAdapter = Get-VMNetworkAdapter -VMName 'dune-awakening' -ErrorAction SilentlyContinue
if ($vmAdapter -and $vmAdapter.IPAddresses) {
$localIp = $vmAdapter.IPAddresses | Where-Object { Test-IsLocalIP $_ }
if ($localIp) {
$vmIp = $localIp[0]
Write-Host " Detected local Hyper-V VM IP: $vmIp" -ForegroundColor Green
}
}
if ($ips.Count -gt 0) {
$VmHost = $ips[-1]
Write-Host " Detected VM IP from SSH history: $VmHost" -ForegroundColor Green
} catch { }
if (-not $vmIp) {
# Fallback: scan known_hosts and prioritize local IPs
$KnownHosts = Join-Path $env:USERPROFILE ".ssh\known_hosts"
if (Test-Path $KnownHosts) {
$content = Get-Content $KnownHosts
$localIps = @()
$publicIps = @()
foreach ($line in $content) {
if ($line -match '\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b') {
$ip = $matches[1]
if (Test-IsLocalIP $ip) {
$localIps += $ip
} else {
$publicIps += $ip
}
}
}
if ($localIps.Count -gt 0) {
$vmIp = $localIps[-1]
Write-Host " Detected local IP from SSH history: $vmIp" -ForegroundColor Green
} elseif ($publicIps.Count -gt 0) {
$vmIp = $publicIps[-1]
Write-Host " Detected IP from SSH history: $vmIp (verify this is your local VM)" -ForegroundColor Yellow
}
}
}
if ($vmIp) { $VmHost = $vmIp }
# Auto-detect external IP (try external service first, then local interfaces)
try {
$HostIp = (Invoke-WebRequest -Uri "https://api.ipify.org" -UseBasicParsing -TimeoutSec 5).Content.Trim()
+13 -24
View File
@@ -3,8 +3,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{% block title %}Dune Awakening Server Dashboard{% endblock %}</title>
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
@@ -40,8 +40,15 @@
<div class="update-spinner"></div>
</div>
</div>
{% block scripts %}{% endblock %}
<script>
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
async function csrfFetch(url, options = {}) {
options.headers = options.headers || {};
options.headers['X-CSRFToken'] = csrfToken;
return fetch(url, options);
}
let updateDismissed = false;
async function checkForUpdate() {
if (updateDismissed) return;
@@ -58,7 +65,7 @@
btn.textContent = 'Checking...';
btn.disabled = true;
try {
const resp = await fetch('/api/update/check', { method: 'POST' });
const resp = await csrfFetch('/api/update/check', { method: 'POST' });
const data = await resp.json();
if (data.available) {
document.getElementById('update-banner').style.display = 'flex';
@@ -84,7 +91,7 @@
banner.style.display = 'none';
progress.style.display = 'flex';
try {
const resp = await fetch('/api/update/apply', { method: 'POST' });
const resp = await csrfFetch('/api/update/apply', { method: 'POST' });
const data = await resp.json();
statusText.textContent = data.message || 'Applying update...';
if (data.success) {
@@ -101,26 +108,8 @@
}
setInterval(checkForUpdate, 60000);
checkForUpdate();
// CSRF: Attach token to all non-GET fetch requests
(function() {
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content;
if (!csrfToken) return;
const origFetch = window.fetch;
window.fetch = function() {
let [resource, config] = arguments;
if (!config) config = {};
if (!config.headers) config.headers = {};
const method = (config.method || 'GET').toUpperCase();
if (method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS') {
if (typeof config.headers === 'object') {
config.headers['X-CSRFToken'] = csrfToken;
}
}
return origFetch(resource, config);
};
})();
</script>
{% block scripts %}{% endblock %}
<style>
.update-banner { background: var(--bg-hover); border-bottom: 2px solid var(--accent); padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text); }
.update-actions { display: flex; gap: 8px; }
@@ -134,4 +123,4 @@
@keyframes spin { to { transform: rotate(360deg); } }
</style>
</body>
</html>
</html>
+3 -3
View File
@@ -634,7 +634,7 @@ document.getElementById('btn-clear-world')?.addEventListener('click', async func
this.disabled = true;
this.textContent = 'Clearing...';
try {
const resp = await fetch('/api/director/character_transfer_clear', { method: 'POST' });
const resp = await csrfFetch('/api/director/character_transfer_clear', { method: 'POST' });
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
document.getElementById('world-status-msg').textContent = 'World status overrides cleared.';
this.textContent = 'Cleared!';
@@ -655,7 +655,7 @@ document.getElementById('btn-apply-transfer')?.addEventListener('click', async f
FreeToTransferCharactersTo: document.getElementById('free-transfer-to').checked
};
try {
const resp = await fetch('/api/director/character_transfer', {
const resp = await csrfFetch('/api/director/character_transfer', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(config)
@@ -674,7 +674,7 @@ document.getElementById('btn-clear-transfer')?.addEventListener('click', async f
this.disabled = true;
this.textContent = 'Clearing...';
try {
const resp = await fetch('/api/director/character_transfer_clear', { method: 'POST' });
const resp = await csrfFetch('/api/director/character_transfer_clear', { method: 'POST' });
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
document.getElementById('transfer-status-msg').textContent = 'Transfer settings cleared.';
this.textContent = 'Cleared!';
+1 -1
View File
@@ -121,7 +121,7 @@ async function saveFile() {
const form = new FormData();
form.append('path', filePath);
form.append('content', editor.value);
const resp = await fetch('/api/files/save', { method: 'POST', body: form });
const resp = await csrfFetch('/api/files/save', { method: 'POST', body: form });
const data = await resp.json();
if (!data.success) {
error.textContent = 'Error: ' + (data.error || 'Failed to save file');
+1 -1
View File
@@ -93,7 +93,7 @@ async function loadFiles(path) {
try {
const form = new FormData();
form.append('path', path);
const resp = await fetch('/api/files/list', { method: 'POST', body: form });
const resp = await csrfFetch('/api/files/list', { method: 'POST', body: form });
const data = await resp.json();
if (!data.success) {
list.innerHTML = '';
+1 -1
View File
@@ -110,7 +110,7 @@
{% endwith %}
<form method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required autofocus>
+7 -7
View File
@@ -468,7 +468,7 @@ function closeModal(id) {
async function submitEdit(form, url) {
const data = new FormData(form);
try {
const resp = await fetch(url, { method: 'POST', body: data });
const resp = await csrfFetch(url, { method: 'POST', body: data });
const result = await resp.json();
if (result.success) {
alert('Saved successfully!');
@@ -486,7 +486,7 @@ async function submitSpecEdit() {
const form = document.getElementById('spec-form');
const data = new FormData(form);
try {
const resp = await fetch('/api/edit_tech_knowledge', { method: 'POST', body: data });
const resp = await csrfFetch('/api/edit_tech_knowledge', { method: 'POST', body: data });
const result = await resp.json();
if (result.success) {
alert('XP saved!');
@@ -526,7 +526,7 @@ async function submitCurrencyEdit(currencyId) {
data.append('currency_id', currencyId);
data.append('new_balance', newBalance);
try {
const resp = await fetch('/api/edit_currency', { method: 'POST', body: data });
const resp = await csrfFetch('/api/edit_currency', { method: 'POST', body: data });
const result = await resp.json();
if (result.success) {
alert('Currency updated successfully!');
@@ -543,7 +543,7 @@ async function submitVitalsEdit() {
const form = document.getElementById('vitals-form');
const data = new FormData(form);
try {
const resp = await fetch('/api/edit_vitals', { method: 'POST', body: data });
const resp = await csrfFetch('/api/edit_vitals', { method: 'POST', body: data });
const result = await resp.json();
if (result.success) {
alert('Vitals updated successfully!');
@@ -565,7 +565,7 @@ async function editItem(itemId, field, currentValue) {
data.append('field', field);
data.append('value', newValue);
try {
const resp = await fetch('/api/edit_item', { method: 'POST', body: data });
const resp = await csrfFetch('/api/edit_item', { method: 'POST', body: data });
const result = await resp.json();
if (result.success) {
const span = document.getElementById('item-' + field.replace('_', '-') + '-' + itemId);
@@ -584,7 +584,7 @@ async function deleteItem(itemId, templateName) {
const data = new FormData();
data.append('item_id', itemId);
try {
const resp = await fetch('/api/delete_item', { method: 'POST', body: data });
const resp = await csrfFetch('/api/delete_item', { method: 'POST', body: data });
const result = await resp.json();
if (result.success) {
const row = document.getElementById('item-row-' + itemId);
@@ -606,7 +606,7 @@ async function submitAddItem() {
const form = document.getElementById('add-item-form');
const data = new FormData(form);
try {
const resp = await fetch('/api/add_item', { method: 'POST', body: data });
const resp = await csrfFetch('/api/add_item', { method: 'POST', body: data });
const result = await resp.json();
if (result.success) {
alert('Item added successfully!');
+7 -7
View File
@@ -117,7 +117,7 @@ document.querySelectorAll('.btn-action[data-action="kick"]').forEach(btn => {
try {
const form = new FormData();
form.append('player_id', pid);
const resp = await fetch('/api/kick_player', { method: 'POST', body: form });
const resp = await csrfFetch('/api/kick_player', { method: 'POST', body: form });
const data = await resp.json();
alert(data.success ? data.message : 'Error: ' + (data.error || 'Failed'));
} catch (e) {
@@ -141,7 +141,7 @@ document.querySelectorAll('.btn-action[data-action="ban"]').forEach(btn => {
form.append('duration', duration);
form.append('reason', reason);
form.append('note', note);
const resp = await fetch('/api/ban_player', { method: 'POST', body: form });
const resp = await csrfFetch('/api/ban_player', { method: 'POST', body: form });
const data = await resp.json();
alert(data.success ? `Banned ${name} for ${duration} minutes` : 'Error: ' + (data.error || 'Failed'));
} catch (e) {
@@ -157,7 +157,7 @@ document.querySelectorAll('.btn-action[data-action="unban"]').forEach(btn => {
try {
const form = new FormData();
form.append('player_id', pid);
const resp = await fetch('/api/unban_player', { method: 'POST', body: form });
const resp = await csrfFetch('/api/unban_player', { method: 'POST', body: form });
const data = await resp.json();
alert(data.success ? `Unbanned ${name}` : 'Error: ' + (data.error || 'Failed'));
} catch (e) {
@@ -172,7 +172,7 @@ document.querySelectorAll('.btn-action[data-action="viewban"]').forEach(btn => {
try {
const form = new FormData();
form.append('player_id', pid);
const resp = await fetch('/api/get_player_ban', { method: 'POST', body: form });
const resp = await csrfFetch('/api/get_player_ban', { method: 'POST', body: form });
const data = await resp.json();
if (data.banned) {
alert(`Ban Info for ${name}:\n\nDuration: ${data.duration} minutes\nReason: ${data.reason}\nNote: ${data.note || 'None'}\nBanned: ${data.banned_at}\nExpires: ${data.expires_at}`);
@@ -191,7 +191,7 @@ document.querySelectorAll('.btn-action[data-action="history"]').forEach(btn => {
try {
const form = new FormData();
form.append('player_id', pid);
const resp = await fetch('/api/get_player_history', { method: 'POST', body: form });
const resp = await csrfFetch('/api/get_player_history', { method: 'POST', body: form });
const data = await resp.json();
if (data.history && data.history.length > 0) {
let msg = `Action History for ${name}:\n\n`;
@@ -225,7 +225,7 @@ document.querySelectorAll('.ip-cell').forEach(cell => {
const form = new FormData();
form.append('player_id', pid);
form.append('ip_address', newIp);
const resp = await fetch('/api/set_player_ip', { method: 'POST', body: form });
const resp = await csrfFetch('/api/set_player_ip', { method: 'POST', body: form });
const data = await resp.json();
if (data.success) {
this.textContent = newIp || '—';
@@ -244,7 +244,7 @@ async function detectIps() {
try {
const btn = document.querySelector('button[onclick="detectIps()"]');
if (btn) { btn.disabled = true; btn.textContent = 'Detecting...'; }
const resp = await fetch('/api/detect_player_ips', { method: 'POST' });
const resp = await csrfFetch('/api/detect_player_ips', { method: 'POST' });
const data = await resp.json();
if (data.success) {
console.log('IP detection:', data.message);
+4 -4
View File
@@ -270,7 +270,7 @@ document.querySelectorAll('.btn-action').forEach(btn => {
const form = new FormData();
form.append('deployment', deploy);
form.append('action', action);
const resp = await fetch('/server/action', { method: 'POST', body: form });
const resp = await csrfFetch('/server/action', { method: 'POST', body: form });
const data = await resp.json();
outputText.textContent = data.output || (data.success ? 'Done' : 'Failed');
} catch (e) {
@@ -298,7 +298,7 @@ document.querySelectorAll('.partition-btn').forEach(btn => {
const form = new FormData();
form.append('deployment', deploy);
form.append('action', 'restart');
const resp = await fetch('/server/action', { method: 'POST', body: form });
const resp = await csrfFetch('/server/action', { method: 'POST', body: form });
const data = await resp.json();
outputText.textContent = data.output || (data.success ? 'Restart initiated' : 'Failed');
} catch (e) {
@@ -344,7 +344,7 @@ async function bgAction(action, btn) {
const url = action === 'update' ? '/server/battlegroup/update' : '/server/battlegroup/action';
const form = new FormData();
form.append('action', action);
const resp = await fetch(url, { method: 'POST', body: form });
const resp = await csrfFetch(url, { method: 'POST', body: form });
const data = await resp.json();
pre.textContent = data.output || (data.success ? `${action} completed successfully` : `Failed: ${data.output}`);
} catch (e) {
@@ -435,7 +435,7 @@ async function loadFwStatus() {
try {
const form = new FormData();
form.append('port', port);
const resp = await fetch('/server/firewall/' + action, { method: 'POST', body: form });
const resp = await csrfFetch('/server/firewall/' + action, { method: 'POST', body: form });
const result = await resp.json();
outputText.textContent = result.output || (result.success ? 'Done' : 'Failed');
await loadFwStatus();