diff --git a/.cargo/config.toml b/.cargo/config.toml index 7115f00159..085f3158fc 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -2,5 +2,8 @@ [target.'cfg(windows)'] rustflags = ["-C", "link-args=/STACK:16777220", "--cfg", "tokio_unstable"] +[target.x86_64-pc-windows-msvc] +linker = "rust-lld" + [build] rustflags = ["--cfg", "tokio_unstable"] diff --git a/.github/workflows/daedalus-docker.yml b/.github/workflows/daedalus-docker.yml index 0dda825412..b0f72c9643 100644 --- a/.github/workflows/daedalus-docker.yml +++ b/.github/workflows/daedalus-docker.yml @@ -22,23 +22,26 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Fetch docker metadata id: docker_meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: ghcr.io/modrinth/daedalus - name: Login to GitHub Images - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: file: ./apps/daedalus_client/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} + cache-from: type=registry,ref=ghcr.io/modrinth/daedalus:main + cache-to: type=inline diff --git a/.github/workflows/labrinth-docker.yml b/.github/workflows/labrinth-docker.yml index 114c8ee489..43577e662f 100644 --- a/.github/workflows/labrinth-docker.yml +++ b/.github/workflows/labrinth-docker.yml @@ -20,23 +20,26 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Fetch docker metadata id: docker_meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: ghcr.io/modrinth/labrinth - name: Login to GitHub Images - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: file: ./apps/labrinth/Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} + cache-from: type=registry,ref=ghcr.io/modrinth/labrinth:main + cache-to: type=inline diff --git a/.github/workflows/theseus-build.yml b/.github/workflows/theseus-build.yml index 76ae5f900c..64ae2b3349 100644 --- a/.github/workflows/theseus-build.yml +++ b/.github/workflows/theseus-build.yml @@ -75,7 +75,7 @@ jobs: rename-to: ${{ startsWith(matrix.platform, 'windows') && 'dasel.exe' || 'dasel' }} chmod: 0755 - - name: โš™๏ธ Set application version + - name: โš™๏ธ Set application version and environment shell: bash run: | APP_VERSION="$(git describe --tags --always | sed -E 's/-([0-9]+)-(g[0-9a-fA-F]+)$/-canary+\1.\2/')" @@ -84,6 +84,8 @@ jobs: dasel put -f packages/app-lib/Cargo.toml -t string -v "${APP_VERSION#v}" 'package.version' dasel put -f apps/app-frontend/package.json -t string -v "${APP_VERSION#v}" 'version' + cp packages/app-lib/.env.prod packages/app-lib/.env + - name: ๐Ÿ’จ Setup Turbo cache uses: rharkor/caching-for-turbo@v1.8 diff --git a/.github/workflows/turbo-ci.yml b/.github/workflows/turbo-ci.yml index 82e9f333a5..fda114e5e4 100644 --- a/.github/workflows/turbo-ci.yml +++ b/.github/workflows/turbo-ci.yml @@ -52,7 +52,7 @@ jobs: # cargo-binstall does not have pre-built binaries for sqlx-cli, so we fall # back to a cached cargo install - name: ๐Ÿงฐ Setup cargo-sqlx - uses: AlexTMjugador/cache-cargo-install-action@feat/features-support + uses: taiki-e/cache-cargo-install-action@v2 with: tool: sqlx-cli locked: false @@ -74,6 +74,10 @@ jobs: cp .env.local .env sqlx database setup + - name: โš™๏ธ Set app environment + working-directory: packages/app-lib + run: cp .env.staging .env + - name: ๐Ÿ” Lint and test run: pnpm run ci diff --git a/Cargo.lock b/Cargo.lock index f6519c3b1f..4dfc698b65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8930,6 +8930,7 @@ dependencies = [ "data-url", "dirs", "discord-rich-presence", + "dotenvy", "dunce", "either", "encoding_rs", @@ -8984,6 +8985,8 @@ dependencies = [ "dashmap", "either", "enumset", + "hyper 1.6.0", + "hyper-util", "native-dialog", "paste", "serde", diff --git a/Cargo.toml b/Cargo.toml index d95e9b6011..341c8838b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,7 @@ heck = "0.5.0" hex = "0.4.3" hickory-resolver = "0.25.2" hmac = "0.12.1" +hyper = "1.6.0" hyper-rustls = { version = "0.27.7", default-features = false, features = [ "http1", "native-tokio", diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue index 1bc25942c7..abfabdf526 100644 --- a/apps/app-frontend/src/App.vue +++ b/apps/app-frontend/src/App.vue @@ -61,9 +61,10 @@ import { renderString } from '@modrinth/utils' import { useFetch } from '@/helpers/fetch.js' import { check } from '@tauri-apps/plugin-updater' import NavButton from '@/components/ui/NavButton.vue' -import { get as getCreds, login, logout } from '@/helpers/mr_auth.js' +import { cancelLogin, get as getCreds, login, logout } from '@/helpers/mr_auth.js' import { get_user } from '@/helpers/cache.js' import AppSettingsModal from '@/components/ui/modal/AppSettingsModal.vue' +import AuthGrantFlowWaitModal from '@/components/ui/modal/AuthGrantFlowWaitModal.vue' import PromotionWrapper from '@/components/ui/PromotionWrapper.vue' import { hide_ads_window, init_ads_window } from '@/helpers/ads.js' import FriendsList from '@/components/ui/friends/FriendsList.vue' @@ -263,6 +264,8 @@ const incompatibilityWarningModal = ref() const credentials = ref() +const modrinthLoginFlowWaitModal = ref() + async function fetchCredentials() { const creds = await getCreds().catch(handleError) if (creds && creds.user_id) { @@ -272,8 +275,24 @@ async function fetchCredentials() { } async function signIn() { - await login().catch(handleError) - await fetchCredentials() + modrinthLoginFlowWaitModal.value.show() + + try { + await login() + await fetchCredentials() + } catch (error) { + if ( + typeof error === 'object' && + typeof error['message'] === 'string' && + error.message.includes('Login canceled') + ) { + // Not really an error due to being a result of user interaction, show nothing + } else { + handleError(error) + } + } finally { + modrinthLoginFlowWaitModal.value.hide() + } } async function logOut() { @@ -402,6 +421,9 @@ function handleAuxClick(e) { + + + diff --git a/apps/app-frontend/src/components/ui/InstanceCreationModal.vue b/apps/app-frontend/src/components/ui/InstanceCreationModal.vue index c09255a7c8..ee6328ff09 100644 --- a/apps/app-frontend/src/components/ui/InstanceCreationModal.vue +++ b/apps/app-frontend/src/components/ui/InstanceCreationModal.vue @@ -305,12 +305,16 @@ const [ get_game_versions().then(shallowRef).catch(handleError), get_loaders() .then((value) => - value - .filter((item) => item.supported_project_types.includes('modpack')) - .map((item) => item.name.toLowerCase()), + ref( + value + .filter((item) => item.supported_project_types.includes('modpack')) + .map((item) => item.name.toLowerCase()), + ), ) - .then(ref) - .catch(handleError), + .catch((err) => { + handleError(err) + return ref([]) + }), ]) loaders.value.unshift('vanilla') diff --git a/apps/app-frontend/src/components/ui/modal/AuthGrantFlowWaitModal.vue b/apps/app-frontend/src/components/ui/modal/AuthGrantFlowWaitModal.vue new file mode 100644 index 0000000000..3f169faff7 --- /dev/null +++ b/apps/app-frontend/src/components/ui/modal/AuthGrantFlowWaitModal.vue @@ -0,0 +1,42 @@ + + diff --git a/apps/app-frontend/src/helpers/mr_auth.js b/apps/app-frontend/src/helpers/mr_auth.js index ecd9aee358..6be54bd213 100644 --- a/apps/app-frontend/src/helpers/mr_auth.js +++ b/apps/app-frontend/src/helpers/mr_auth.js @@ -16,3 +16,7 @@ export async function logout() { export async function get() { return await invoke('plugin:mr-auth|get') } + +export async function cancelLogin() { + return await invoke('plugin:mr-auth|cancel_modrinth_login') +} diff --git a/apps/app-playground/src/main.rs b/apps/app-playground/src/main.rs index a2c2b89224..13da97d396 100644 --- a/apps/app-playground/src/main.rs +++ b/apps/app-playground/src/main.rs @@ -15,7 +15,7 @@ pub async fn authenticate_run() -> theseus::Result { println!("A browser window will now open, follow the login flow there."); let login = minecraft_auth::begin_login().await?; - println!("Open URL {} in a browser", login.redirect_uri.as_str()); + println!("Open URL {} in a browser", login.auth_request_uri.as_str()); println!("Please enter URL code: "); let mut input = String::new(); diff --git a/apps/app/Cargo.toml b/apps/app/Cargo.toml index d1c67affcb..e1a612e55b 100644 --- a/apps/app/Cargo.toml +++ b/apps/app/Cargo.toml @@ -31,6 +31,8 @@ thiserror.workspace = true daedalus.workspace = true chrono.workspace = true either.workspace = true +hyper = { workspace = true, features = ["server"] } +hyper-util.workspace = true url.workspace = true urlencoding.workspace = true diff --git a/apps/app/build.rs b/apps/app/build.rs index 7a4da8872a..4574acee95 100644 --- a/apps/app/build.rs +++ b/apps/app/build.rs @@ -120,7 +120,12 @@ fn main() { .plugin( "mr-auth", InlinedPlugin::new() - .commands(&["modrinth_login", "logout", "get"]) + .commands(&[ + "modrinth_login", + "logout", + "get", + "cancel_modrinth_login", + ]) .default_permission( DefaultPermissionRule::AllowAllCommands, ), diff --git a/apps/app/src/api/auth.rs b/apps/app/src/api/auth.rs index b084feb4d7..c18bd770ee 100644 --- a/apps/app/src/api/auth.rs +++ b/apps/app/src/api/auth.rs @@ -33,7 +33,7 @@ pub async fn login( let window = tauri::WebviewWindowBuilder::new( &app, "signin", - tauri::WebviewUrl::External(flow.redirect_uri.parse().map_err( + tauri::WebviewUrl::External(flow.auth_request_uri.parse().map_err( |_| { theseus::ErrorKind::OtherError( "Error parsing auth redirect URL".to_string(), @@ -77,6 +77,7 @@ pub async fn login( window.close()?; Ok(None) } + #[tauri::command] pub async fn remove_user(user: uuid::Uuid) -> Result<()> { Ok(minecraft_auth::remove_user(user).await?) diff --git a/apps/app/src/api/mod.rs b/apps/app/src/api/mod.rs index 294e784f64..a2ccb11782 100644 --- a/apps/app/src/api/mod.rs +++ b/apps/app/src/api/mod.rs @@ -22,6 +22,8 @@ pub mod cache; pub mod friends; pub mod worlds; +mod oauth_utils; + pub type Result = std::result::Result; // // Main returnable Theseus GUI error diff --git a/apps/app/src/api/mr_auth.rs b/apps/app/src/api/mr_auth.rs index 43fee54366..2143d20c5e 100644 --- a/apps/app/src/api/mr_auth.rs +++ b/apps/app/src/api/mr_auth.rs @@ -1,79 +1,70 @@ use crate::api::Result; -use chrono::{Duration, Utc}; +use crate::api::TheseusSerializableError; +use crate::api::oauth_utils; +use tauri::Manager; +use tauri::Runtime; use tauri::plugin::TauriPlugin; -use tauri::{Manager, Runtime, UserAttentionType}; +use tauri_plugin_opener::OpenerExt; use theseus::prelude::*; +use tokio::sync::oneshot; pub fn init() -> TauriPlugin { tauri::plugin::Builder::new("mr-auth") - .invoke_handler(tauri::generate_handler![modrinth_login, logout, get,]) + .invoke_handler(tauri::generate_handler![ + modrinth_login, + logout, + get, + cancel_modrinth_login, + ]) .build() } #[tauri::command] pub async fn modrinth_login( app: tauri::AppHandle, -) -> Result> { - let redirect_uri = mr_auth::authenticate_begin_flow(); - - let start = Utc::now(); - - if let Some(window) = app.get_webview_window("modrinth-signin") { - window.close()?; - } - - let window = tauri::WebviewWindowBuilder::new( - &app, - "modrinth-signin", - tauri::WebviewUrl::External(redirect_uri.parse().map_err(|_| { - theseus::ErrorKind::OtherError( - "Error parsing auth redirect URL".to_string(), +) -> Result { + let (auth_code_recv_socket_tx, auth_code_recv_socket) = oneshot::channel(); + let auth_code = tokio::spawn(oauth_utils::auth_code_reply::listen( + auth_code_recv_socket_tx, + )); + + let auth_code_recv_socket = auth_code_recv_socket.await.unwrap()?; + + let auth_request_uri = format!( + "{}?launcher=true&ipver={}&port={}", + mr_auth::authenticate_begin_flow(), + if auth_code_recv_socket.is_ipv4() { + "4" + } else { + "6" + }, + auth_code_recv_socket.port() + ); + + app.opener() + .open_url(auth_request_uri, None::<&str>) + .map_err(|e| { + TheseusSerializableError::Theseus( + theseus::ErrorKind::OtherError(format!( + "Failed to open auth request URI: {e}" + )) + .into(), ) - .as_error() - })?), - ) - .min_inner_size(420.0, 632.0) - .inner_size(420.0, 632.0) - .max_inner_size(420.0, 632.0) - .zoom_hotkeys_enabled(false) - .title("Sign into Modrinth") - .always_on_top(true) - .center() - .build()?; - - window.request_user_attention(Some(UserAttentionType::Critical))?; - - while (Utc::now() - start) < Duration::minutes(10) { - if window.title().is_err() { - // user closed window, cancelling flow - return Ok(None); - } + })?; - if window - .url()? - .as_str() - .starts_with("https://launcher-files.modrinth.com") - { - let url = window.url()?; + let Some(auth_code) = auth_code.await.unwrap()? else { + return Err(TheseusSerializableError::Theseus( + theseus::ErrorKind::OtherError("Login canceled".into()).into(), + )); + }; - let code = url.query_pairs().find(|(key, _)| key == "code"); + let credentials = mr_auth::authenticate_finish_flow(&auth_code).await?; - window.close()?; - - return if let Some((_, code)) = code { - let val = mr_auth::authenticate_finish_flow(&code).await?; - - Ok(Some(val)) - } else { - Ok(None) - }; - } - - tokio::time::sleep(std::time::Duration::from_millis(50)).await; + if let Some(main_window) = app.get_window("main") { + main_window.set_focus().ok(); } - window.close()?; - Ok(None) + Ok(credentials) } #[tauri::command] @@ -85,3 +76,8 @@ pub async fn logout() -> Result<()> { pub async fn get() -> Result> { Ok(theseus::mr_auth::get_credentials().await?) } + +#[tauri::command] +pub fn cancel_modrinth_login() { + oauth_utils::auth_code_reply::stop_listeners(); +} diff --git a/apps/app/src/api/oauth_utils/auth_code_reply.rs b/apps/app/src/api/oauth_utils/auth_code_reply.rs new file mode 100644 index 0000000000..4e4a529284 --- /dev/null +++ b/apps/app/src/api/oauth_utils/auth_code_reply.rs @@ -0,0 +1,159 @@ +//! A minimal OAuth 2.0 authorization code grant flow redirection/reply loopback URI HTTP +//! server implementation, compliant with [RFC 6749]'s authorization code grant flow and +//! [RFC 8252]'s best current practices for OAuth 2.0 in native apps. +//! +//! This server is needed for the step 4 of the OAuth authentication dance represented in +//! figure 1 of [RFC 8252]. +//! +//! Further reading: https://www.oauth.com/oauth2-servers/oauth-native-apps/redirect-urls-for-native-apps/ +//! +//! [RFC 6749]: https://datatracker.ietf.org/doc/html/rfc6749 +//! [RFC 8252]: https://datatracker.ietf.org/doc/html/rfc8252 + +use std::{ + net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}, + sync::{LazyLock, Mutex}, + time::Duration, +}; + +use hyper::body::Incoming; +use hyper_util::rt::{TokioIo, TokioTimer}; +use theseus::ErrorKind; +use tokio::{ + net::TcpListener, + sync::{broadcast, oneshot}, +}; + +static SERVER_SHUTDOWN: LazyLock> = + LazyLock::new(|| broadcast::channel(1024).0); + +/// Starts a temporary HTTP server to receive OAuth 2.0 authorization code grant flow redirects +/// on a loopback interface with an ephemeral port. The caller can know the bound socket address +/// by listening on the counterpart channel for `listen_socket_tx`. +/// +/// If the server is stopped before receiving an authorization code, `Ok(None)` is returned. +pub async fn listen( + listen_socket_tx: oneshot::Sender>, +) -> Result, theseus::Error> { + // IPv4 is tried first for the best compatibility and performance with most systems. + // IPv6 is also tried in case IPv4 is not available. Resolving "localhost" is avoided + // to prevent failures deriving from improper name resolution setup. Any available + // ephemeral port is used to prevent conflicts with other services. This is all as per + // RFC 8252's recommendations + const ANY_LOOPBACK_SOCKET: &[SocketAddr] = &[ + SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0), + SocketAddr::new(IpAddr::V6(Ipv6Addr::LOCALHOST), 0), + ]; + + let listener = match TcpListener::bind(ANY_LOOPBACK_SOCKET).await { + Ok(listener) => { + listen_socket_tx + .send(listener.local_addr().map_err(|e| { + ErrorKind::OtherError(format!( + "Failed to get auth code reply socket address: {e}" + )) + .into() + })) + .ok(); + + listener + } + Err(e) => { + let error_msg = + format!("Failed to bind auth code reply socket: {e}"); + + listen_socket_tx + .send(Err(ErrorKind::OtherError(error_msg.clone()).into())) + .ok(); + + return Err(ErrorKind::OtherError(error_msg).into()); + } + }; + + let mut auth_code = Mutex::new(None); + let mut shutdown_notification = SERVER_SHUTDOWN.subscribe(); + + while auth_code.get_mut().unwrap().is_none() { + let client_socket = tokio::select! { + biased; + _ = shutdown_notification.recv() => { + break; + } + conn_accept_result = listener.accept() => { + match conn_accept_result { + Ok((socket, _)) => socket, + Err(e) => { + tracing::warn!("Failed to accept auth code reply: {e}"); + continue; + } + } + } + }; + + if let Err(e) = hyper::server::conn::http1::Builder::new() + .keep_alive(false) + .header_read_timeout(Duration::from_secs(5)) + .timer(TokioTimer::new()) + .auto_date_header(false) + .serve_connection( + TokioIo::new(client_socket), + hyper::service::service_fn(|req| handle_reply(req, &auth_code)), + ) + .await + { + tracing::warn!("Failed to handle auth code reply: {e}"); + } + } + + Ok(auth_code.into_inner().unwrap()) +} + +/// Stops any active OAuth 2.0 authorization code grant flow reply listening HTTP servers. +pub fn stop_listeners() { + SERVER_SHUTDOWN.send(()).ok(); +} + +async fn handle_reply( + req: hyper::Request, + auth_code_out: &Mutex>, +) -> Result, hyper::http::Error> { + if req.method() != hyper::Method::GET { + return hyper::Response::builder() + .status(hyper::StatusCode::METHOD_NOT_ALLOWED) + .header("Allow", "GET") + .body("".into()); + } + + // The authorization code is guaranteed to be sent as a "code" query parameter + // in the request URI query string as per RFC 6749 ยง 4.1.2 + let auth_code = req.uri().query().and_then(|query_string| { + query_string + .split('&') + .filter_map(|query_pair| query_pair.split_once('=')) + .find_map(|(key, value)| (key == "code").then_some(value)) + }); + + let response = if let Some(auth_code) = auth_code { + *auth_code_out.lock().unwrap() = Some(auth_code.to_string()); + + hyper::Response::builder() + .status(hyper::StatusCode::OK) + .header("Content-Type", "text/html;charset=utf-8") + .body( + include_str!("auth_code_reply/page.html") + .replace("{{title}}", "Success") + .replace("{{message}}", "You have successfully signed in! You can close this page now."), + ) + } else { + hyper::Response::builder() + .status(hyper::StatusCode::BAD_REQUEST) + .header("Content-Type", "text/html;charset=utf-8") + .body( + include_str!("auth_code_reply/page.html") + .replace("{{title}}", "Error") + .replace("{{message}}", "Authorization code not found. Please try signing in again."), + ) + }?; + + Ok(response) +} diff --git a/apps/app/src/api/oauth_utils/auth_code_reply/page.html b/apps/app/src/api/oauth_utils/auth_code_reply/page.html new file mode 100644 index 0000000000..f0ccff4ad7 --- /dev/null +++ b/apps/app/src/api/oauth_utils/auth_code_reply/page.html @@ -0,0 +1 @@ +Sign In - Modrinth App
diff --git a/apps/app/src/api/oauth_utils/mod.rs b/apps/app/src/api/oauth_utils/mod.rs new file mode 100644 index 0000000000..4182cfb6c3 --- /dev/null +++ b/apps/app/src/api/oauth_utils/mod.rs @@ -0,0 +1,3 @@ +//! Assorted utilities for OAuth 2.0 authorization flows. + +pub mod auth_code_reply; diff --git a/apps/app/tauri.conf.json b/apps/app/tauri.conf.json index 724e536d85..8667de5c63 100644 --- a/apps/app/tauri.conf.json +++ b/apps/app/tauri.conf.json @@ -63,6 +63,7 @@ "height": 800, "resizable": true, "title": "Modrinth App", + "label": "main", "width": 1280, "minHeight": 700, "minWidth": 1100, diff --git a/apps/daedalus_client/Dockerfile b/apps/daedalus_client/Dockerfile index 9ea70f9ca6..271c829aab 100644 --- a/apps/daedalus_client/Dockerfile +++ b/apps/daedalus_client/Dockerfile @@ -1,9 +1,19 @@ +# syntax=docker/dockerfile:1 + FROM rust:1.88.0 AS build WORKDIR /usr/src/daedalus COPY . . -RUN cargo build --release --package daedalus_client +RUN --mount=type=cache,target=/usr/src/daedalus/target \ + --mount=type=cache,target=/usr/local/cargo/git/db \ + --mount=type=cache,target=/usr/local/cargo/registry \ + cargo build --release --package daedalus_client + +FROM build AS artifacts +RUN --mount=type=cache,target=/usr/src/daedalus/target \ + mkdir /daedalus \ + && cp /usr/src/daedalus/target/release/daedalus_client /daedalus/daedalus_client FROM debian:bookworm-slim @@ -11,7 +21,7 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates openssl \ && rm -rf /var/lib/apt/lists/* -COPY --from=build /usr/src/daedalus/target/release/daedalus_client /daedalus/daedalus_client -WORKDIR /daedalus_client +COPY --from=artifacts /daedalus /daedalus -CMD /daedalus/daedalus_client +WORKDIR /daedalus_client +CMD ["/daedalus/daedalus_client"] diff --git a/apps/frontend/nuxt.config.ts b/apps/frontend/nuxt.config.ts index e84ae0c0fe..59e3715a9c 100644 --- a/apps/frontend/nuxt.config.ts +++ b/apps/frontend/nuxt.config.ts @@ -34,7 +34,7 @@ const enabledLocales: string[] = []; /** * Overrides for the categories of the certain locales. */ -const localesCategoriesOverrides: Partial = { +const localesCategoriesOverrides: Partial> = { "en-x-pirate": "fun", "en-x-updown": "fun", "en-x-lolcat": "fun", @@ -260,28 +260,21 @@ export default defineNuxtConfig({ const omorphiaLocales: string[] = []; const omorphiaLocaleSets = new Map(); - const externalLocales = [ - "node_modules/@modrinth/ui/src/locales/en-US", - "node_modules/@modrinth/moderation/locales/en-US", - ]; + for await (const localeDir of globIterate("node_modules/@modrinth/ui/src/locales/*", { + posix: true, + })) { + const tag = basename(localeDir); + omorphiaLocales.push(tag); - for (const localePath of externalLocales) { - for await (const localeDir of globIterate(localePath, { - posix: true, - })) { - const tag = basename(localeDir); - omorphiaLocales.push(tag); + const localeFiles: { from: string; format?: string }[] = []; - const localeFiles: { from: string; format?: string }[] = []; + omorphiaLocaleSets.set(tag, { files: localeFiles }); - omorphiaLocaleSets.set(tag, { files: localeFiles }); - - for await (const localeFile of globIterate(`${localeDir}/*`, { posix: true })) { - localeFiles.push({ - from: pathToFileURL(localeFile).toString(), - format: "default", - }); - } + for await (const localeFile of globIterate(`${localeDir}/*`, { posix: true })) { + localeFiles.push({ + from: pathToFileURL(localeFile).toString(), + format: "default", + }); } } @@ -308,7 +301,7 @@ export default defineNuxtConfig({ format: "crowdin", }); } else if (fileName === "meta.json") { - const meta: Record = await fs + const meta: Record = await fs .readFile(localeFile, "utf8") .then((date) => JSON.parse(date)); const localeMeta = (locale.meta ??= {}); @@ -387,7 +380,7 @@ export default defineNuxtConfig({ }, }, }, - modules: ["@vintl/nuxt", "@pinia/nuxt"], + modules: ["@vintl/nuxt", "@pinia/nuxt", "pinia-plugin-persistedstate/nuxt"], vintl: { defaultLocale: "en-US", locales: [ diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 7cded83142..011eafb647 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -59,10 +59,12 @@ "markdown-it": "14.1.0", "pathe": "^1.1.2", "pinia": "^2.1.7", + "pinia-plugin-persistedstate": "^4.4.1", "prettier": "^3.6.2", "qrcode.vue": "^3.4.0", "semver": "^7.5.4", "three": "^0.172.0", + "vue-confetti-explosion": "^1.0.2", "vue-multiselect": "3.0.0-alpha.2", "vue-typed-virtual-list": "^1.0.10", "vue3-ace-editor": "^2.2.4", diff --git a/apps/frontend/src/components/ui/ModerationChecklist.vue b/apps/frontend/src/components/ui/ModerationChecklist.vue deleted file mode 100644 index b21fd99544..0000000000 --- a/apps/frontend/src/components/ui/ModerationChecklist.vue +++ /dev/null @@ -1,1133 +0,0 @@ - - - - - diff --git a/apps/frontend/src/components/ui/ProjectMemberHeader.vue b/apps/frontend/src/components/ui/ProjectMemberHeader.vue index 9afe2d16d2..9bef208591 100644 --- a/apps/frontend/src/components/ui/ProjectMemberHeader.vue +++ b/apps/frontend/src/components/ui/ProjectMemberHeader.vue @@ -1,442 +1,510 @@ - -const emit = defineEmits<{ - toggleCollapsed: []; - updateMembers: []; - setProcessing: [processing: boolean]; -}>(); + diff --git a/apps/frontend/src/components/ui/moderation/ModerationDelphiReportCard.vue b/apps/frontend/src/components/ui/moderation/ModerationDelphiReportCard.vue new file mode 100644 index 0000000000..961f340a34 --- /dev/null +++ b/apps/frontend/src/components/ui/moderation/ModerationDelphiReportCard.vue @@ -0,0 +1,179 @@ + + + + + diff --git a/apps/frontend/src/components/ui/moderation/ModerationQueueCard.vue b/apps/frontend/src/components/ui/moderation/ModerationQueueCard.vue new file mode 100644 index 0000000000..8dcb0f8f5d --- /dev/null +++ b/apps/frontend/src/components/ui/moderation/ModerationQueueCard.vue @@ -0,0 +1,195 @@ + + + diff --git a/apps/frontend/src/components/ui/moderation/ModerationReportCard.vue b/apps/frontend/src/components/ui/moderation/ModerationReportCard.vue new file mode 100644 index 0000000000..0e006db50e --- /dev/null +++ b/apps/frontend/src/components/ui/moderation/ModerationReportCard.vue @@ -0,0 +1,267 @@ + + + + diff --git a/apps/frontend/src/components/ui/moderation/ChecklistKeybindsModal.vue b/apps/frontend/src/components/ui/moderation/checklist/ChecklistKeybindsModal.vue similarity index 100% rename from apps/frontend/src/components/ui/moderation/ChecklistKeybindsModal.vue rename to apps/frontend/src/components/ui/moderation/checklist/ChecklistKeybindsModal.vue diff --git a/apps/frontend/src/components/ui/moderation/NewModerationChecklist.vue b/apps/frontend/src/components/ui/moderation/checklist/ModerationChecklist.vue similarity index 87% rename from apps/frontend/src/components/ui/moderation/NewModerationChecklist.vue rename to apps/frontend/src/components/ui/moderation/checklist/ModerationChecklist.vue index 2126091ad6..44f928dbdf 100644 --- a/apps/frontend/src/components/ui/moderation/NewModerationChecklist.vue +++ b/apps/frontend/src/components/ui/moderation/checklist/ModerationChecklist.vue @@ -42,9 +42,9 @@

You are done moderating this project! -