mirror of
https://github.com/moghtech/komodo.git
synced 2026-09-07 08:00:54 +00:00
* feat: add maintenance window management to suppress alerts during planned activities (#550) * feat: add scheduled maintenance windows to server configuration - Add maintenance window configuration to server entities - Implement maintenance window UI components with data table layout - Add maintenance tab to server interface - Suppress alerts during maintenance windows * chore: enhance maintenance windows with types and permission improvements - Add chrono dependency to Rust client core for time handling - Add comprehensive TypeScript types for maintenance windows (MaintenanceWindow, MaintenanceScheduleType, MaintenanceTime, DayOfWeek) - Improve maintenance config component to use usePermissions hook for better permission handling - Update package dependencies * feat: restore alert buffer system to prevent noise * fix yarn fe * fix the merge with new alerting changes * move alert buffer handle out of loop * nit * fix server version changes * unneeded buffer clear --------- Co-authored-by: mbecker20 <becker.maxh@gmail.com> * set version 1.18.2 * failed OIDC provider init doesn't cause panic, just error log * OIDC: use userinfo endpoint to get preffered username for user. * add profile to scopes and account for username already taken * search through server docker lists * move maintenance stuff * refactor maintenance schedules to have more toml compatible structure * daily schedule type use struct * add timezone to core info response * frontend can build with new maintenance types * Action monaco expose KomodoClient to init another client * flatten out the nested enum * update maintenance schedule types * dev-3 * implement maintenance windows on alerters * dev-4 * add IanaTimezone enum * typeshare timezone enum * maintenance modes almost done on servers AND alerters * maintenance schedules working * remove mention of migrator * Procedure / Action schedule timezone selector * improve timezone selector to display configure core TZ * dev-5 * refetch core version * add version to server list item info * add periphery version in server table * dev-6 * capitalize Unknown server status in cache * handle unknown version case * set server table sizes * default resource_poll_interval 1-hr * ensure parent folder exists before cloning * document Build Attach permission * git actions return absolute path * stack linked repos * resource toml replace linked_repo id with name * validate incoming linked repo * add linked repo to stack list item info * stack list item info resolved linked repo information * configure linked repo stack * to repo links * dev-7 * sync: replace linked repo with name for execute compare * obscure provider tokens in table view * clean up stack write w/ refactor * Resource Sync / Build start support Repo attach * add stack clone path config * Builds + syncs can link to repos * dev-9 * update ts * fix linked repo not included in resource sync list item info * add linked repo UI for builds / syncs * fix commit linked repo sync * include linked repo syncs * correct Sync / Build config mode * dev-12 fix resource sync inclusion w/ linked_repo * remove unneed sync commit todo!() * fix other config.repo.is_empty issues * replace ids in all to toml exports * Ensure git pull before commit for linear history, add to update logs * fix fe for linked repo cases * consolidate linked repo config component * fix resource sync commit behavior * dev 17 * Build uses Pull or Clone api to setup build source * capitalize Clone Repo stage * mount PullOrCloneRepo * dev-19 * Expand supported container names and also avoid unnecessary name formatting * dev-20 * add periphery /terminal/execute/container api * periphery client execute_container_exec method * implement execute container, deployment, stack exec * gen types * execute container exec method * clean up client / fix fe * enumerate exec ts methods for each resource type * fix and gen ts client * fix FE use connect_exec * add url log when terminal ws fail to connect * ts client server allow terminal.js * FE preload terminal.js / .d.ts * dev-23 fix stack terminal fail to connect when not explicitly setting container name * update docs on attach perms * 1.18.2 --------- Co-authored-by: Samuel Cardoso <R3D2@users.noreply.github.com>
68 lines
1.3 KiB
Rust
68 lines
1.3 KiB
Rust
use anyhow::{Context, anyhow};
|
|
use axum::{
|
|
Router,
|
|
extract::Path,
|
|
http::{HeaderMap, HeaderValue},
|
|
routing::get,
|
|
};
|
|
use reqwest::StatusCode;
|
|
use serde::Deserialize;
|
|
use serror::AddStatusCodeError;
|
|
use tokio::fs;
|
|
|
|
use crate::config::core_config;
|
|
|
|
pub fn router() -> Router {
|
|
Router::new().route("/{path}", get(serve_client_file))
|
|
}
|
|
|
|
const ALLOWED_FILES: &[&str] = &[
|
|
"lib.js",
|
|
"lib.d.ts",
|
|
"types.js",
|
|
"types.d.ts",
|
|
"responses.js",
|
|
"responses.d.ts",
|
|
"terminal.js",
|
|
"terminal.d.ts",
|
|
];
|
|
|
|
#[derive(Deserialize)]
|
|
struct FilePath {
|
|
path: String,
|
|
}
|
|
|
|
#[axum::debug_handler]
|
|
async fn serve_client_file(
|
|
Path(FilePath { path }): Path<FilePath>,
|
|
) -> serror::Result<(HeaderMap, String)> {
|
|
if !ALLOWED_FILES.contains(&path.as_str()) {
|
|
return Err(
|
|
anyhow!("File {path} not found.")
|
|
.status_code(StatusCode::NOT_FOUND),
|
|
);
|
|
}
|
|
|
|
let contents = fs::read_to_string(format!(
|
|
"{}/client/{path}",
|
|
core_config().frontend_path
|
|
))
|
|
.await
|
|
.with_context(|| format!("Failed to read file: {path}"))?;
|
|
|
|
let mut headers = HeaderMap::new();
|
|
|
|
if path.ends_with(".js") {
|
|
headers.insert(
|
|
"X-TypeScript-Types",
|
|
HeaderValue::from_str(&format!(
|
|
"/client/{}",
|
|
path.replace(".js", ".d.ts")
|
|
))
|
|
.context("?? Invalid Header Value")?,
|
|
);
|
|
}
|
|
|
|
Ok((headers, contents))
|
|
}
|