Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 46 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,21 @@ bind_addr = "0.0.0.0:7878"
# Authentication: server validates clients via the framework UserStore.
# No extra config needed for the server. Clients set auth_token below.

# Trash settings
# ──────────────
# When a file is deleted it is moved into .bh_filesync/trash/ under the root,
# mirroring the original folder structure. An index.json inside the trash
# directory records metadata (original path, deletion time, size, …) for
# every entry so files can be listed and restored via the API.
#
# trash_expiry_days — automatically purge entries older than N days.
# 0 or omitted → keep forever (manual purge only).
# trash_expiry_days = 30

# full_scan_interval_secs — how often to do a full filesystem re-scan to
# catch changes that inotify may have missed. Default: 900 (15 minutes).
# full_scan_interval_secs = 900

exclude_patterns = [
# ── Python ────────────────────────────────────────────────
"**/venv/**",
Expand Down
Binary file added crates/core/assets/bytehive_icon_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/core/assets/bytehive_icon_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/core/assets/bytehive_icon_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/core/assets/bytehive_icon_64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/core/assets/bytehive_icon_96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions crates/core/assets/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/svg+xml" href="/bytehive-icon.svg" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/bytehive_icon_32x32.png"
/>
<title>Bytehive — Ops</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand Down
7 changes: 7 additions & 0 deletions crates/core/assets/filebrowser.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/svg+xml" href="/bytehive-icon.svg" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/bytehive_icon_32x32.png"
/>
<title>Files — Bytehive</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand Down
7 changes: 7 additions & 0 deletions crates/core/assets/password_share.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/svg+xml" href="/bytehive-icon.svg" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/bytehive_icon_32x32.png"
/>
<title>Protected Share — Bytehive</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand Down
19 changes: 15 additions & 4 deletions crates/core/assets/portal.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/svg+xml" href="/bytehive-icon.svg" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/bytehive_icon_32x32.png"
/>
<title>Bytehive</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand Down Expand Up @@ -688,7 +695,10 @@
id="inp-user"
autocomplete="username"
placeholder="username"
onkeydown="if(event.key==='Enter')document.getElementById('inp-pass').focus()"
onkeydown="
if (event.key === 'Enter')
document.getElementById('inp-pass').focus();
"
/>
</div>
<div class="lfield">
Expand All @@ -698,7 +708,7 @@
id="inp-pass"
autocomplete="current-password"
placeholder="••••••••"
onkeydown="if(event.key==='Enter')doLogin()"
onkeydown="if (event.key === 'Enter') doLogin();"
/>
</div>
<button
Expand Down Expand Up @@ -920,8 +930,9 @@
const r = document.getElementById("sb-role");
r.textContent = grps.length ? grps.join(", ") : "(no groups)";
r.className = "sb-user-role " + topGroup;
document.getElementById("sb-admin-link").style.display =
isAdmin ? "block" : "none";
document.getElementById("sb-admin-link").style.display = isAdmin
? "block"
: "none";
}

async function loadNav() {
Expand Down
7 changes: 7 additions & 0 deletions crates/core/assets/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/svg+xml" href="/bytehive-icon.svg" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/bytehive_icon_32x32.png"
/>
<title>Bytehive — First Run Setup</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand Down
7 changes: 7 additions & 0 deletions crates/core/assets/share_error.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/svg+xml" href="/bytehive-icon.svg" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/bytehive_icon_32x32.png"
/>
<title>Link Error — Bytehive</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand Down
3 changes: 3 additions & 0 deletions crates/core/src/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ pub const SHARE_ERROR: &str = include_str!("../assets/share_error.html");
pub const PASSWORD_SHARE_ERROR: &str = r#"<p class="err">Incorrect password — try again.</p>"#;

pub const PASSWORD_SHARE: &str = include_str!("../assets/password_share.html");

pub const BYTEHIVE_ICON_32_PNG: &[u8] = include_bytes!("../assets/bytehive_icon_32x32.png");
pub const BYTEHIVE_ICON_64_PNG: &[u8] = include_bytes!("../assets/bytehive_icon_64x64.png");
20 changes: 19 additions & 1 deletion crates/core/src/http.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::auth::Auth;
use crate::bus::{BusMessage, MessageBus};
use crate::html::{ADMIN_DASHBOARD_HTML, PORTAL_HTML, SETUP_HTML};
use crate::html::{
ADMIN_DASHBOARD_HTML, BYTEHIVE_ICON_32_PNG, BYTEHIVE_ICON_64_PNG, PORTAL_HTML, SETUP_HTML,
};
use crate::registry::AppRegistry;
use crate::users::{AuthContext, AuthMethod, Group, UserEntry, UserStore};

Expand Down Expand Up @@ -270,6 +272,8 @@ fn build_router(state: ApiState) -> Router {
.route("/", get(portal_handler))
.route("/bytehive-icon.svg", get(bytehive_icon_handler))
.route("/bytehive-logo-full.svg", get(bytehive_logo_full_handler))
.route("/bytehive_icon_32x32.png", get(bytehive_icon_32_handler))
.route("/bytehive_icon_64x64.png", get(bytehive_icon_64_handler))
.route("/web/*path", get(static_handler))
.route("/s/:token", get(share_handler).post(share_handler))
.nest("/api/auth", public_auth.merge(authenticated_auth))
Expand Down Expand Up @@ -633,6 +637,20 @@ async fn bytehive_logo_full_handler() -> impl IntoResponse {
)
}

async fn bytehive_icon_32_handler() -> impl IntoResponse {
(
[(axum::http::header::CONTENT_TYPE, "image/png")],
BYTEHIVE_ICON_32_PNG,
)
}

async fn bytehive_icon_64_handler() -> impl IntoResponse {
(
[(axum::http::header::CONTENT_TYPE, "image/png")],
BYTEHIVE_ICON_64_PNG,
)
}

async fn static_handler(State(s): State<ApiState>, Path(rel): Path<String>) -> impl IntoResponse {
if s.web_root.is_empty() {
return (StatusCode::NOT_FOUND, "no web_root configured").into_response();
Expand Down
2 changes: 2 additions & 0 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub mod error;
pub mod html;
pub mod http;
pub mod registry;
pub mod trash;
pub mod users;

pub use app::{App, AppContext, AppManifest};
Expand All @@ -15,6 +16,7 @@ pub use config::{AppConfig, FrameworkConfig};
pub use error::CoreError;
pub use http::{ApiServer, HttpRequest, HttpResponse};
pub use registry::{AppInfo, AppRegistry, AppStatus};
pub use trash::{TrashEntry, TrashManager};
pub use users::{
ApiKey, ApiKeyInfo, AuthContext, AuthMethod, Group, Session, UserEntry, UserInfo, UserStore,
GROUP_ADMIN, GROUP_USER,
Expand Down
Loading
Loading