This commit was merged in pull request #416.
This commit is contained in:
@@ -20,7 +20,7 @@ cargo build -p visions-server
|
||||
cd visions/ui && trunk build
|
||||
|
||||
# Run server (requires env vars)
|
||||
DATABASE_PATH=... RELYING_PARTY=... RELYING_PARTY_ORIGIN=... PWA_BASE_URL=... cargo run -p visions-server
|
||||
DATABASE_PATH=... RELYING_PARTY=... RELYING_PARTY_ORIGIN=... SPA_BASE_URL=... cargo run -p visions-server
|
||||
|
||||
# Run all tests
|
||||
cargo test
|
||||
|
||||
@@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
### Added
|
||||
- There is a new ENABLE_PASSKEYS flag that allows passkeys to be created and used in the UI.
|
||||
-
|
||||
|
||||
### Changed
|
||||
- **BREAKING** PWA_BASE_URL is now SPA_BASE_URL. (D0050)
|
||||
|
||||
### Internal
|
||||
- The Tabletop message now contains the scene id, background image, tabletop image, and current scene title. The Background and Title images have been removed.
|
||||
|
||||
@@ -3,7 +3,7 @@ version: "3"
|
||||
env:
|
||||
ENV: dev
|
||||
DATABASE_PATH: "../app.sqlite"
|
||||
PWA_BASE_URL: "https://localhost:8080"
|
||||
SPA_BASE_URL: "https://localhost:8080"
|
||||
RELYING_PARTY: "localhost"
|
||||
RELYING_PARTY_ORIGIN: "https://localhost"
|
||||
ENABLE_PASSKEYS: true
|
||||
|
||||
@@ -5,7 +5,7 @@ use tower_http::trace::{self, TraceLayer};
|
||||
use tracing::Level;
|
||||
use visions_core::{app::App, database::Database};
|
||||
use visions_server_lib::router::api_routes;
|
||||
use visions_types::PwaConfig;
|
||||
use visions_types::SPAConfig;
|
||||
|
||||
/*
|
||||
#[allow(unused)]
|
||||
@@ -42,10 +42,10 @@ async fn main() -> Result<(), String> {
|
||||
}
|
||||
};
|
||||
|
||||
let pwa_base_url = match std::env::var("PWA_BASE_URL") {
|
||||
let spa_base_url = match std::env::var("SPA_BASE_URL") {
|
||||
Ok(val) => val,
|
||||
Err(_) => {
|
||||
return Err("PWA_BASE_URL not specified".to_owned());
|
||||
return Err("SPA_BASE_URL not specified".to_owned());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -57,8 +57,8 @@ async fn main() -> Result<(), String> {
|
||||
_ => false,
|
||||
};
|
||||
|
||||
let pwa_config = PwaConfig {
|
||||
pwa_url: pwa_base_url,
|
||||
let spa_config = SPAConfig {
|
||||
spa_url: spa_base_url,
|
||||
enable_passkeys,
|
||||
};
|
||||
|
||||
@@ -82,7 +82,7 @@ async fn main() -> Result<(), String> {
|
||||
.compact()
|
||||
.init();
|
||||
let app = Router::new()
|
||||
.nest("/api", api_routes(app.clone(), pwa_config))
|
||||
.nest("/api", api_routes(app.clone(), spa_config))
|
||||
.layer(
|
||||
TraceLayer::new_for_http()
|
||||
.make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO))
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::{
|
||||
|
||||
use super::{character_routes, game_routes};
|
||||
|
||||
pub fn api_routes(app: App, pwa_config: PwaConfig) -> Router {
|
||||
pub fn api_routes(app: App, spa_config: SPAConfig) -> Router {
|
||||
Router::new()
|
||||
.route(
|
||||
"/health",
|
||||
@@ -30,7 +30,7 @@ pub fn api_routes(app: App, pwa_config: PwaConfig) -> Router {
|
||||
)
|
||||
.route(
|
||||
"/config",
|
||||
get((StatusCode::OK, serde_json::to_vec(&pwa_config).unwrap())),
|
||||
get((StatusCode::OK, serde_json::to_vec(&spa_config).unwrap())),
|
||||
)
|
||||
.route(
|
||||
"/auth",
|
||||
|
||||
@@ -8,8 +8,8 @@ use webauthn_rs_proto::{
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct PwaConfig {
|
||||
pub pwa_url: String,
|
||||
pub struct SPAConfig {
|
||||
pub spa_url: String,
|
||||
pub enable_passkeys: bool,
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ impl UnauthedClient {
|
||||
handle_response(response).await
|
||||
}
|
||||
|
||||
pub async fn config() -> Result<PwaConfig, ClientError> {
|
||||
pub async fn config() -> Result<SPAConfig, ClientError> {
|
||||
let response = Request::get("/api/config")
|
||||
.header("Content-Type", "application/json")
|
||||
.send()
|
||||
|
||||
@@ -102,7 +102,7 @@ fn switch(route: Route) -> Html {
|
||||
|
||||
#[function_component]
|
||||
fn AppWrapper() -> Html {
|
||||
let config: UseStateHandle<Option<PwaConfig>> = use_state(|| None);
|
||||
let config: UseStateHandle<Option<SPAConfig>> = use_state(|| None);
|
||||
|
||||
use_effect_with(
|
||||
(),
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
clone,
|
||||
};
|
||||
use gloo_console::error;
|
||||
use visions_types::{PwaConfig, SessionId, UserOverview};
|
||||
use visions_types::{SPAConfig, SessionId, UserOverview};
|
||||
use wasm_bindgen::JsValue;
|
||||
use web_sys::{Storage, Window};
|
||||
use yew::prelude::*;
|
||||
@@ -36,12 +36,12 @@ pub enum AppAction {
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
pub struct AppState {
|
||||
config: PwaConfig,
|
||||
config: SPAConfig,
|
||||
connection: Client,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
pub fn new(config: PwaConfig) -> Self {
|
||||
pub fn new(config: SPAConfig) -> Self {
|
||||
Self {
|
||||
config,
|
||||
connection: Client::Unauthed(UnauthedClient {}),
|
||||
@@ -49,7 +49,7 @@ impl AppState {
|
||||
}
|
||||
|
||||
pub fn base_url(&self) -> &str {
|
||||
&self.config.pwa_url
|
||||
&self.config.spa_url
|
||||
}
|
||||
|
||||
pub fn enable_passkeys(&self) -> bool {
|
||||
@@ -96,7 +96,7 @@ impl Reducible for AppState {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init_state(config: PwaConfig) -> AppState {
|
||||
pub fn init_state(config: SPAConfig) -> AppState {
|
||||
AppState::new(config)
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ where
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
pub struct StateProviderProps {
|
||||
pub config: PwaConfig,
|
||||
pub config: SPAConfig,
|
||||
pub children: Html,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user