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)
|
||||
|
||||
# Intervals
|
||||
POLL_INTERVAL = _config.get("POLL_INTERVAL", 30)
|
||||
HIT_CHECK_INTERVAL = _config.get("HIT_CHECK_INTERVAL", 60)
|
||||
REASSIGN_DELAY = _config.get("REASSIGN_DELAY", 120)
|
||||
|
||||
|
||||
Binary file not shown.
@@ -31,24 +31,29 @@ def reload_config_from_file():
|
||||
async def get_config():
|
||||
"""Get all config values (with sensitive values masked)"""
|
||||
path = Path("data/config.json")
|
||||
if not path.exists():
|
||||
# Return defaults from config.py (masked)
|
||||
config_values = {
|
||||
|
||||
# Default config values from config.py
|
||||
default_values = {
|
||||
"TORN_API_KEY": config_module.TORN_API_KEY,
|
||||
"FFSCOUTER_KEY": config_module.FFSCOUTER_KEY,
|
||||
"DISCORD_TOKEN": config_module.DISCORD_TOKEN,
|
||||
"ALLOWED_CHANNEL_ID": config_module.ALLOWED_CHANNEL_ID,
|
||||
"POLL_INTERVAL": config_module.POLL_INTERVAL,
|
||||
"HIT_CHECK_INTERVAL": config_module.HIT_CHECK_INTERVAL,
|
||||
"REASSIGN_DELAY": config_module.REASSIGN_DELAY,
|
||||
"ASSIGNMENT_TIMEOUT": config_module.ASSIGNMENT_TIMEOUT,
|
||||
"ASSIGNMENT_REMINDER": config_module.ASSIGNMENT_REMINDER,
|
||||
"CHAIN_TIMER_THRESHOLD": config_module.CHAIN_TIMER_THRESHOLD
|
||||
}
|
||||
else:
|
||||
|
||||
if path.exists():
|
||||
with open(path, "r", encoding="utf-8") as 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
|
||||
masked_config = config_values.copy()
|
||||
@@ -66,6 +71,17 @@ async def update_config(req: ConfigUpdateRequest):
|
||||
"""Update a single config value"""
|
||||
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
|
||||
if path.exists():
|
||||
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,
|
||||
"DISCORD_TOKEN": config_module.DISCORD_TOKEN,
|
||||
"ALLOWED_CHANNEL_ID": config_module.ALLOWED_CHANNEL_ID,
|
||||
"POLL_INTERVAL": config_module.POLL_INTERVAL,
|
||||
"HIT_CHECK_INTERVAL": config_module.HIT_CHECK_INTERVAL,
|
||||
"REASSIGN_DELAY": config_module.REASSIGN_DELAY,
|
||||
"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"]:
|
||||
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
|
||||
data["config"][req.key] = req.value
|
||||
|
||||
@@ -4,7 +4,6 @@ const CONFIG_FIELDS = {
|
||||
"FFSCOUTER_KEY": "ffscouter-key",
|
||||
"DISCORD_TOKEN": "discord-token",
|
||||
"ALLOWED_CHANNEL_ID": "allowed-channel-id",
|
||||
"POLL_INTERVAL": "poll-interval",
|
||||
"HIT_CHECK_INTERVAL": "hit-check-interval",
|
||||
"REASSIGN_DELAY": "reassign-delay",
|
||||
"ASSIGNMENT_TIMEOUT": "assignment-timeout",
|
||||
|
||||
@@ -70,13 +70,6 @@
|
||||
<button class="config-save-btn" data-key="ASSIGNMENT_REMINDER">Save</button>
|
||||
</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">
|
||||
<label for="hit-check-interval">Hit Check Interval (seconds)</label>
|
||||
<p class="config-description">Interval for checking hit completion</p>
|
||||
|
||||
Reference in New Issue
Block a user