Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a34860fca | |||
| 56106622b2 | |||
| 21c11446d7 | |||
| 0093128001 |
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -34,4 +34,4 @@ jobs:
|
||||
context: .
|
||||
push: true
|
||||
tags: git.kaisei.app/amatsugu/aoba:${{ env.VERSION }}
|
||||
build-args: VERSION=${ env.VERSION }
|
||||
build-args: VERSION=${{ env.VERSION }}
|
||||
|
||||
1
AobaClient/.env
Normal file
1
AobaClient/.env
Normal file
@@ -0,0 +1 @@
|
||||
APP_VERSION=Debug
|
||||
4923
AobaClient/Cargo.lock
generated
4923
AobaClient/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,7 @@ web-sys = { version = "0.3.77", features = ["Storage", "Window"] }
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = { version = "*", default-features = false, features = ["prost"] }
|
||||
dotenv = "0.15.0"
|
||||
|
||||
[features]
|
||||
default = ["web"]
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
use dotenv::dotenv;
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tonic_build::configure()
|
||||
.build_server(false)
|
||||
@@ -6,6 +11,26 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
&["../AobaServer/Proto/Aoba.proto", "../AobaServer/Proto/Auth.proto"],
|
||||
&["../AobaServer/Proto/"],
|
||||
)?;
|
||||
|
||||
forward_env();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn forward_env() {
|
||||
let dest_path = "./src/env.rs";
|
||||
let mut f = File::create(&dest_path).unwrap();
|
||||
f.write_all(b"// This file is automatically generated by build.rs\n\n")
|
||||
.unwrap();
|
||||
|
||||
dotenv().ok();
|
||||
for (key, value) in env::vars() {
|
||||
if key.starts_with("APP_") {
|
||||
f.write_all("#[allow(dead_code)]\n".as_bytes()).unwrap();
|
||||
let line = format!(
|
||||
"pub const {}: &'static str = \"{}\";\n",
|
||||
key,
|
||||
value.replace("\"", "\\\"")
|
||||
);
|
||||
f.write_all(line.as_bytes()).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::env;
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::{Route, contexts::AuthContext};
|
||||
use crate::{Route, contexts::AuthContext, env::APP_VERSION};
|
||||
|
||||
const NAV_CSS: Asset = asset!("/assets/style/nav.scss");
|
||||
const NAV_ICON: Asset = asset!("/assets/favicon.ico");
|
||||
@@ -49,7 +49,7 @@ pub fn Widgets() -> Element {
|
||||
#[component]
|
||||
pub fn Utils() -> Element {
|
||||
let mut auth_context = use_context::<AuthContext>();
|
||||
let version = env::var("APP_VERSION").unwrap_or("DEBUG".into());
|
||||
let version = APP_VERSION;
|
||||
rsx! {
|
||||
div { class: "utils",
|
||||
div { "{version}" }
|
||||
|
||||
4
AobaClient/src/env.rs
Normal file
4
AobaClient/src/env.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
// This file is automatically generated by build.rs
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const APP_VERSION: &'static str = "Debug";
|
||||
@@ -1,5 +1,6 @@
|
||||
pub mod components;
|
||||
pub mod contexts;
|
||||
mod env;
|
||||
mod layouts;
|
||||
pub mod models;
|
||||
pub mod route;
|
||||
|
||||
@@ -132,6 +132,11 @@ public class ThumbnailService(IMongoDatabase db, AobaService aobaService)
|
||||
{
|
||||
opt.WithCustomArgument($"-vf \"crop='min(in_w,in_h)':'min(in_w,in_h)',scale={w}:{w}\" -loop 0 -r 15")
|
||||
.ForceFormat("webp");
|
||||
}).Configure(cfg =>
|
||||
{
|
||||
#if !DEBUG
|
||||
cfg.BinaryFolder = "/usr/bin";
|
||||
#endif
|
||||
}).ProcessSynchronously();
|
||||
output.Position = 0;
|
||||
return output;
|
||||
|
||||
@@ -60,4 +60,5 @@ WORKDIR /app
|
||||
|
||||
COPY --from=publish /app/publish .
|
||||
COPY --from=client-builder /bin/ffmpeg /bin/ffprobe /bin/ffplay /usr/bin/
|
||||
ENV APP_VERSION=$VERSION
|
||||
ENTRYPOINT ["dotnet", "AobaServer.dll"]
|
||||
|
||||
Reference in New Issue
Block a user