Removed Poll Interval setting
This commit is contained in:
Binary file not shown.
@@ -30,7 +30,6 @@ DISCORD_TOKEN = _config.get("DISCORD_TOKEN", "YOUR_DISCORD_BOT_TOKEN_HERE")
|
|||||||
ALLOWED_CHANNEL_ID = _config.get("ALLOWED_CHANNEL_ID", 0)
|
ALLOWED_CHANNEL_ID = _config.get("ALLOWED_CHANNEL_ID", 0)
|
||||||
|
|
||||||
# Intervals
|
# Intervals
|
||||||
POLL_INTERVAL = _config.get("POLL_INTERVAL", 30)
|
|
||||||
HIT_CHECK_INTERVAL = _config.get("HIT_CHECK_INTERVAL", 60)
|
HIT_CHECK_INTERVAL = _config.get("HIT_CHECK_INTERVAL", 60)
|
||||||
REASSIGN_DELAY = _config.get("REASSIGN_DELAY", 120)
|
REASSIGN_DELAY = _config.get("REASSIGN_DELAY", 120)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -31,24 +31,29 @@ def reload_config_from_file():
|
|||||||
async def get_config():
|
async def get_config():
|
||||||
"""Get all config values (with sensitive values masked)"""
|
"""Get all config values (with sensitive values masked)"""
|
||||||
path = Path("data/config.json")
|
path = Path("data/config.json")
|
||||||
if not path.exists():
|
|
||||||
# Return defaults from config.py (masked)
|
# Default config values from config.py
|
||||||
config_values = {
|
default_values = {
|
||||||
"TORN_API_KEY": config_module.TORN_API_KEY,
|
"TORN_API_KEY": config_module.TORN_API_KEY,
|
||||||
"FFSCOUTER_KEY": config_module.FFSCOUTER_KEY,
|
"FFSCOUTER_KEY": config_module.FFSCOUTER_KEY,
|
||||||
"DISCORD_TOKEN": config_module.DISCORD_TOKEN,
|
"DISCORD_TOKEN": config_module.DISCORD_TOKEN,
|
||||||
"ALLOWED_CHANNEL_ID": config_module.ALLOWED_CHANNEL_ID,
|
"ALLOWED_CHANNEL_ID": config_module.ALLOWED_CHANNEL_ID,
|
||||||
"POLL_INTERVAL": config_module.POLL_INTERVAL,
|
|
||||||
"HIT_CHECK_INTERVAL": config_module.HIT_CHECK_INTERVAL,
|
"HIT_CHECK_INTERVAL": config_module.HIT_CHECK_INTERVAL,
|
||||||
"REASSIGN_DELAY": config_module.REASSIGN_DELAY,
|
"REASSIGN_DELAY": config_module.REASSIGN_DELAY,
|
||||||
"ASSIGNMENT_TIMEOUT": config_module.ASSIGNMENT_TIMEOUT,
|
"ASSIGNMENT_TIMEOUT": config_module.ASSIGNMENT_TIMEOUT,
|
||||||
"ASSIGNMENT_REMINDER": config_module.ASSIGNMENT_REMINDER,
|
"ASSIGNMENT_REMINDER": config_module.ASSIGNMENT_REMINDER,
|
||||||
"CHAIN_TIMER_THRESHOLD": config_module.CHAIN_TIMER_THRESHOLD
|
"CHAIN_TIMER_THRESHOLD": config_module.CHAIN_TIMER_THRESHOLD
|
||||||
}
|
}
|
||||||
else:
|
|
||||||
|
if path.exists():
|
||||||
with open(path, "r", encoding="utf-8") as f:
|
with open(path, "r", encoding="utf-8") as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
config_values = data.get("config", {})
|
file_values = data.get("config", {})
|
||||||
|
|
||||||
|
# Merge defaults with file values (file values take precedence)
|
||||||
|
config_values = {**default_values, **file_values}
|
||||||
|
else:
|
||||||
|
config_values = default_values
|
||||||
|
|
||||||
# Mask sensitive values
|
# Mask sensitive values
|
||||||
masked_config = config_values.copy()
|
masked_config = config_values.copy()
|
||||||
@@ -66,6 +71,17 @@ async def update_config(req: ConfigUpdateRequest):
|
|||||||
"""Update a single config value"""
|
"""Update a single config value"""
|
||||||
path = Path("data/config.json")
|
path = Path("data/config.json")
|
||||||
|
|
||||||
|
# Valid config keys (from config.py)
|
||||||
|
valid_keys = {
|
||||||
|
"TORN_API_KEY", "FFSCOUTER_KEY", "DISCORD_TOKEN", "ALLOWED_CHANNEL_ID",
|
||||||
|
"HIT_CHECK_INTERVAL", "REASSIGN_DELAY",
|
||||||
|
"ASSIGNMENT_TIMEOUT", "ASSIGNMENT_REMINDER", "CHAIN_TIMER_THRESHOLD"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Validate key is valid
|
||||||
|
if req.key not in valid_keys:
|
||||||
|
raise HTTPException(status_code=400, detail="Invalid config key")
|
||||||
|
|
||||||
# Load existing or create from current config
|
# Load existing or create from current config
|
||||||
if path.exists():
|
if path.exists():
|
||||||
with open(path, "r", encoding="utf-8") as f:
|
with open(path, "r", encoding="utf-8") as f:
|
||||||
@@ -78,7 +94,6 @@ async def update_config(req: ConfigUpdateRequest):
|
|||||||
"FFSCOUTER_KEY": config_module.FFSCOUTER_KEY,
|
"FFSCOUTER_KEY": config_module.FFSCOUTER_KEY,
|
||||||
"DISCORD_TOKEN": config_module.DISCORD_TOKEN,
|
"DISCORD_TOKEN": config_module.DISCORD_TOKEN,
|
||||||
"ALLOWED_CHANNEL_ID": config_module.ALLOWED_CHANNEL_ID,
|
"ALLOWED_CHANNEL_ID": config_module.ALLOWED_CHANNEL_ID,
|
||||||
"POLL_INTERVAL": config_module.POLL_INTERVAL,
|
|
||||||
"HIT_CHECK_INTERVAL": config_module.HIT_CHECK_INTERVAL,
|
"HIT_CHECK_INTERVAL": config_module.HIT_CHECK_INTERVAL,
|
||||||
"REASSIGN_DELAY": config_module.REASSIGN_DELAY,
|
"REASSIGN_DELAY": config_module.REASSIGN_DELAY,
|
||||||
"ASSIGNMENT_TIMEOUT": config_module.ASSIGNMENT_TIMEOUT,
|
"ASSIGNMENT_TIMEOUT": config_module.ASSIGNMENT_TIMEOUT,
|
||||||
@@ -87,9 +102,10 @@ async def update_config(req: ConfigUpdateRequest):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Validate key exists
|
# Add key if it doesn't exist in config (for backwards compatibility)
|
||||||
if req.key not in data["config"]:
|
if req.key not in data["config"]:
|
||||||
raise HTTPException(status_code=400, detail="Invalid config key")
|
print(f"Adding new config key: {req.key}")
|
||||||
|
data["config"][req.key] = getattr(config_module, req.key)
|
||||||
|
|
||||||
# Update value
|
# Update value
|
||||||
data["config"][req.key] = req.value
|
data["config"][req.key] = req.value
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const CONFIG_FIELDS = {
|
|||||||
"FFSCOUTER_KEY": "ffscouter-key",
|
"FFSCOUTER_KEY": "ffscouter-key",
|
||||||
"DISCORD_TOKEN": "discord-token",
|
"DISCORD_TOKEN": "discord-token",
|
||||||
"ALLOWED_CHANNEL_ID": "allowed-channel-id",
|
"ALLOWED_CHANNEL_ID": "allowed-channel-id",
|
||||||
"POLL_INTERVAL": "poll-interval",
|
|
||||||
"HIT_CHECK_INTERVAL": "hit-check-interval",
|
"HIT_CHECK_INTERVAL": "hit-check-interval",
|
||||||
"REASSIGN_DELAY": "reassign-delay",
|
"REASSIGN_DELAY": "reassign-delay",
|
||||||
"ASSIGNMENT_TIMEOUT": "assignment-timeout",
|
"ASSIGNMENT_TIMEOUT": "assignment-timeout",
|
||||||
|
|||||||
@@ -70,13 +70,6 @@
|
|||||||
<button class="config-save-btn" data-key="ASSIGNMENT_REMINDER">Save</button>
|
<button class="config-save-btn" data-key="ASSIGNMENT_REMINDER">Save</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="config-group">
|
|
||||||
<label for="poll-interval">Poll Interval (seconds)</label>
|
|
||||||
<p class="config-description">General polling interval for data refresh</p>
|
|
||||||
<input type="number" id="poll-interval" class="config-input" />
|
|
||||||
<button class="config-save-btn" data-key="POLL_INTERVAL">Save</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="config-group">
|
<div class="config-group">
|
||||||
<label for="hit-check-interval">Hit Check Interval (seconds)</label>
|
<label for="hit-check-interval">Hit Check Interval (seconds)</label>
|
||||||
<p class="config-description">Interval for checking hit completion</p>
|
<p class="config-description">Interval for checking hit completion</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user