Skip to content

Commit

Permalink
[WIP] Video uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksbgbg committed Mar 1, 2024
1 parent 7d596fc commit 9ebe1b9
Show file tree
Hide file tree
Showing 13 changed files with 519 additions and 9 deletions.
1 change: 1 addition & 0 deletions backend-rs/.env.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[config.app]
config_root = "streamfox_home_local/config"
data_root = "streamfox_home_local/data"
host = [0, 0, 0, 0]
port = 8601
# Half a year, in seconds
Expand Down
63 changes: 63 additions & 0 deletions backend-rs/Cargo.lock

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

13 changes: 13 additions & 0 deletions backend-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
[workspace]
resolver = "2"
members = ["streamfox", "migration", "entity", "fs", "fs-file"]

[profile.release]
opt-level = 3
debug = "full"
# split-debuginfo = '...' # Platform-specific.
strip = "none"
debug-assertions = false
overflow-checks = false
lto = "fat"
panic = "unwind"
incremental = true
codegen-units = 16
rpath = false
6 changes: 6 additions & 0 deletions backend-rs/entity/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ impl Display for Id {
}
}

impl From<Id> for String {
fn from(value: Id) -> Self {
value.to_string()
}
}

impl FromStr for Id {
type Err = bs58::decode::Error;

Expand Down
4 changes: 3 additions & 1 deletion backend-rs/entity/src/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use crate::id::Id;
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
#[derive(
Clone, Debug, PartialEq, Eq, PartialOrd, EnumIter, DeriveActiveEnum, Serialize, Deserialize,
)]
#[sea_orm(rs_type = "i16", db_type = "SmallInteger")]
#[serde(untagged)]
pub enum Status {
Expand Down
10 changes: 9 additions & 1 deletion backend-rs/fs-file/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::path::{Path, PathBuf};
use tokio::fs::{self, File as TokioFile};
use tokio::fs::{self, File as TokioFile, OpenOptions};

#[derive(Debug)]
pub struct File {
Expand All @@ -24,4 +24,12 @@ impl File {

TokioFile::create(&self.path).await
}

pub async fn open(&self) -> std::io::Result<TokioFile> {
if self.path.exists() {
OpenOptions::new().append(true).open(&self.path).await
} else {
self.create().await
}
}
}
6 changes: 5 additions & 1 deletion backend-rs/streamfox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
[dependencies]
axum = "0.7.4"
axum-extra = { version = "0.9.2", features = ["cookie"] }
axum-range = { version = "0.4.0", default-features = false }
base64 = "0.21.7"
bcrypt = "0.15.0"
bs58 = { version = "0.5.0", default-features = false }
Expand All @@ -15,6 +16,7 @@ convert_case = "0.6.0"
entity = { version = "0.0.0", path = "../entity", default-features = false }
fs = { version = "0.0.0", path = "../fs", default-features = false }
fs-file = { version = "0.0.0", path = "../fs-file", default-features = false }
futures = { version = "0.3.30", default-features = false }
jsonwebtoken = { version = "9.2.0", default-features = false }
lazy_static = "1.4.0"
migration = { version = "0.0.0", path = "../migration", default-features = false }
Expand All @@ -23,11 +25,13 @@ ring = "0.17.7"
sea-orm = { version = "0.12.14", features = ["runtime-tokio-rustls", "sqlx-postgres", "debug-print"] }
sea-orm-migration = { version = "0.12.14", default-features = false }
serde = { version = "1.0.196", features = ["derive"] }
serde-this-or-that = { version = "0.4.2", default-features = false }
serde_json = "1.0.113"
serde_with = { version = "3.6.0", features = ["chrono_0_4"] }
thiserror = "1.0.56"
time = "0.3.34"
tokio = { version = "1.36.0", features = ["rt-multi-thread"] }
tokio = { version = "1.36.0", features = ["rt-multi-thread", "process"] }
tokio-util = { version = "0.7.10", default-features = false, features = ["io"] }
toml-env = "1.1.1"
tower-http = { version = "0.5.1", features = ["trace"] }
tracing = "0.1.40"
Expand Down
Loading

0 comments on commit 9ebe1b9

Please sign in to comment.