From 8b9c8ea83a1da6e069020d65aade7bcca5284d63 Mon Sep 17 00:00:00 2001 From: Nicolas Pernoud Date: Thu, 16 Jan 2025 15:48:07 +0100 Subject: [PATCH] fix: updated dependencies, switching from html renderer to default --- .github/workflows/build.yml | 2 +- .github/workflows/security-audit.yml | 2 +- .vscode/launch.json | 10 +- Dockerfile | 6 +- backend/Cargo.toml | 34 +++---- backend/src/apps/mod.rs | 3 +- backend/src/configuration.rs | 29 ++++-- backend/src/davs/mod.rs | 6 +- backend/src/dir_server.rs | 3 +- backend/src/main.rs | 12 +-- backend/src/mocks.rs | 3 +- backend/src/oauth2.rs | 7 +- backend/src/server.rs | 6 +- backend/src/users.rs | 69 ++++++++++--- .../gradle/wrapper/gradle-wrapper.properties | 2 +- frontend/android/settings.gradle | 2 +- frontend/lib/components/explorer.dart | 14 +-- frontend/lib/components/iframe_webview.dart | 6 +- frontend/lib/models/app.dart | 2 +- frontend/lib/platform/web.dart | 8 +- frontend/lib/utils.dart | 12 ++- frontend/pubspec.lock | 96 ++++++++++--------- frontend/pubspec.yaml | 8 +- 23 files changed, 210 insertions(+), 132 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d8194b..d69de03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,7 +58,7 @@ jobs: uses: subosito/flutter-action@v2 with: channel: "stable" - flutter-version: "3.24.3" + flutter-version: "3.27.2" - name: Decode android/key.jks run: echo "${{ secrets.KEY_JKS }}" | base64 --decode > android/key.jks - name: Decode android/key.properties diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml index 1b92b8d..b1476bc 100644 --- a/.github/workflows/security-audit.yml +++ b/.github/workflows/security-audit.yml @@ -22,4 +22,4 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: EmbarkStudios/cargo-deny-action@v1 with: - rust-version: "1.83.0" + rust-version: "1.84.0" diff --git a/.vscode/launch.json b/.vscode/launch.json index c781781..72aad59 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,8 +12,6 @@ "args": [ "--web-hostname", "atrium.127.0.0.1.nip.io", - "--web-renderer", - "html", "--web-port", "3000" ] @@ -23,10 +21,14 @@ "request": "launch", "name": "Debug atrium backend (axum)", "cargo": { - "args": ["build", "--manifest-path", "backend/Cargo.toml"] + "args": [ + "build", + "--manifest-path", + "backend/Cargo.toml" + ] }, "args": [], "cwd": "${workspaceRoot}/backend" } ] -} +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 536d482..36c0e33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ########################### # Set up an environnement to cross-compile the app for musl to create a statically-linked binary -FROM --platform=$BUILDPLATFORM rust:1.82 AS backend-builder +FROM --platform=$BUILDPLATFORM rust:1.84 AS backend-builder ARG TARGETPLATFORM RUN case "$TARGETPLATFORM" in \ "linux/amd64") echo x86_64-unknown-linux-gnu > /rust_target.txt ;; \ @@ -53,11 +53,11 @@ RUN chown -Rf "${UID}":"${UID}" /myapp # Stage 2 : Frontend build # ############################ -FROM --platform=$BUILDPLATFORM ghcr.io/cirruslabs/flutter:3.24.3 AS frontend-builder +FROM --platform=$BUILDPLATFORM ghcr.io/cirruslabs/flutter:3.27.2 AS frontend-builder WORKDIR /build COPY ./frontend . RUN flutter pub get -RUN flutter build web --csp --web-renderer html +RUN flutter build web ######################### # Stage 3 : Final image # diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 4411978..71e0a1c 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -12,13 +12,13 @@ path = "src/main.rs" name = "atrium" [dependencies] -anyhow = { default-features = false, version = "1.0.94" } +anyhow = { default-features = false, version = "1.0.95" } argon2 = { features = ["alloc", "password-hash"], default-features = false, version = "0.5.3" } async_zip = { features = ["deflate", "tokio"], default-features = false, version = "0.0.17" } async-stream = "0.3.6" async-walkdir = "2.0.0" -axum = { version = "0.7.9", features = ["http2", "json", "query", "tokio"], default-features = false } -axum-extra = { version = "0.9.6", features = ["cookie-private", "typed-header"], default-features = false } +axum = { version = "0.8.1", features = ["http2", "json", "query", "tokio"], default-features = false } +axum-extra = { version = "0.10.0", features = ["cookie-private", "typed-header"], default-features = false } axum-server = "0.7.1" base64ct = { version = "1.6.0", features = ["alloc"] } chacha20poly1305 = { version = "0.10.1", features = ["stream"], default-features = false } @@ -29,9 +29,9 @@ futures-util = { default-features = false, version = "0.3.31" } headers = "0.4.0" http = "1.2.0" http-body-util = "0.1.2" -hyper = { version = "1.5.1", default-features = false } +hyper = { version = "1.5.2", default-features = false } hyper-util = { version = "0.1.10", features = ["client-legacy", "http1", "tokio"], default-features = false } -hyper-rustls = { version = "0.27.3", features = ["http1", "http2", "ring", "tls12", "webpki-tokio"], default-features = false } +hyper-rustls = { version = "0.27.5", features = ["http1", "http2", "ring", "tls12", "webpki-tokio"], default-features = false } hyper-hickory = { version = "0.7.0", default-features = false, features = ["system-config"] } jsonwebtoken = { version = "9.3.0", default-features = false } maxminddb = "0.24.0" @@ -39,22 +39,22 @@ mime_guess = { default-features = false, version = "2.0.5" } # TEMPORARY oauth2 = { version = "5.0.0-rc.1", default-features = false } percent-encoding = { default-features = false, version = "2.3.1" } -quick-xml = "0.37.1" +quick-xml = "0.37.2" rand = { default-features = false, version = "0.8.5" } -rcgen = { version = "0.13.1", default-features = false, optional = true } -rustls = { default-features = false, version = "0.23.19", features = ["ring"] } -rustls-pki-types = { version = "1.10.0" } +rcgen = { version = "0.13.2", default-features = false, optional = true } +rustls = { default-features = false, version = "0.23.21", features = ["ring"] } +rustls-pki-types = { version = "1.10.1" } rustls-acme = { version = "0.12.1", features = ["axum", "ring"], default-features = false } -serde = { version = "1.0.215", default-features = false } -serde_json = { default-features = false, version = "1.0.133" } +serde = { version = "1.0.217", default-features = false } +serde_json = { default-features = false, version = "1.0.135" } serde_yml = "0.0.12" sha2 = { default-features = false, version = "0.10.8" } -sysinfo = { default-features = false, version = "0.33.0", features = ["disk", "system"] } +sysinfo = { default-features = false, version = "0.33.1", features = ["disk", "system"] } time = { default-features = false, version = "0.3.37" } -tokio = { version = "1.42.0", features = ["full"], default-features = false } +tokio = { version = "1.43.0", features = ["full"], default-features = false } tokio-stream = { version = "0.1.17", default-features = false } tokio-util = { version = "0.7.13", default-features = false } -tower = { default-features = false, version = "0.5.1", features = ["util"] } +tower = { default-features = false, version = "0.5.2", features = ["util"] } tower-http = { version = "0.6.2", features = ["fs"], default-features = false } tower-service = "0.3.3" tracing = { default-features = false, version = "0.1.41" } @@ -62,15 +62,15 @@ tracing-appender = "0.2.3" tracing-subscriber = { version = "0.3.19", features = ["ansi", "env-filter", "local-time"], default-features = false } trim-in-place = "0.1.7" urlencoding = "2.1.3" -uuid = { version = "1.11.0", features = ["fast-rng", "v4"], default-features = false } +uuid = { version = "1.12.0", features = ["fast-rng", "v4"], default-features = false } [features] default = ["self_signed"] self_signed = ["dep:rcgen"] [dev-dependencies] -async-tungstenite = { version = "0.28.1", features = ["tokio-runtime"] } -reqwest = { version = "0.12.9", default-features = false, features = ["cookies", "json", "rustls-tls", "stream"] } +async-tungstenite = { version = "0.28.2", features = ["tokio-runtime"] } +reqwest = { version = "0.12.12", default-features = false, features = ["cookies", "json", "rustls-tls", "stream"] } tungstenite = "0.24.0" [profile.release_optimized] diff --git a/backend/src/apps/mod.rs b/backend/src/apps/mod.rs index 09c2cb4..0c1143e 100644 --- a/backend/src/apps/mod.rs +++ b/backend/src/apps/mod.rs @@ -1,6 +1,6 @@ use axum::{ body::Body, - extract::{ConnectInfo, Host, Path, State}, + extract::{ConnectInfo, Path, State}, http::{ uri::{Authority, Scheme}, Response, @@ -8,6 +8,7 @@ use axum::{ response::IntoResponse, Json, }; +use axum_extra::extract::Host; use base64ct::Encoding; use headers::HeaderValue; use http::{ diff --git a/backend/src/configuration.rs b/backend/src/configuration.rs index 8e9c89f..6838adc 100644 --- a/backend/src/configuration.rs +++ b/backend/src/configuration.rs @@ -7,14 +7,11 @@ use crate::{ utils::{is_default, option_string_trim, string_trim}, }; use anyhow::Result; -use axum::{ - async_trait, - extract::{FromRef, FromRequestParts}, -}; +use axum::extract::{FromRef, FromRequestParts, OptionalFromRequestParts}; use http::request::Parts; use hyper::StatusCode; use serde::{Deserialize, Serialize}; -use std::{collections::HashMap, sync::Arc}; +use std::{collections::HashMap, convert::Infallible, sync::Arc}; fn http_port() -> u16 { 8080 @@ -351,7 +348,6 @@ impl HostType { } } -#[async_trait] impl FromRequestParts for HostType where S: Send + Sync, @@ -362,7 +358,7 @@ where async fn from_request_parts(parts: &mut Parts, state: &S) -> Result { let configmap = ConfigMap::from_ref(state); - let host = axum::extract::Host::from_request_parts(parts, state) + let host = axum_extra::extract::Host::from_request_parts(parts, state) .await .map_err(|_| StatusCode::NOT_FOUND)?; @@ -379,6 +375,25 @@ where } } +impl OptionalFromRequestParts for HostType +where + S: Send + Sync, + ConfigMap: FromRef, +{ + type Rejection = Infallible; + + async fn from_request_parts( + parts: &mut Parts, + state: &S, + ) -> Result, Self::Rejection> { + Ok( + >::from_request_parts(parts, state) + .await + .ok(), + ) + } +} + #[cfg(test)] mod tests { use std::fs; diff --git a/backend/src/davs/mod.rs b/backend/src/davs/mod.rs index 48fa8da..2e74636 100644 --- a/backend/src/davs/mod.rs +++ b/backend/src/davs/mod.rs @@ -11,9 +11,10 @@ use crate::{ }; use axum::{ body::Body, - extract::{ConnectInfo, Host}, + extract::ConnectInfo, http::{Request, Response}, }; +use axum_extra::extract::Host; use http::Method; use hyper::StatusCode; use std::{net::SocketAddr, sync::LazyLock}; @@ -45,7 +46,8 @@ pub async fn webdav_handler( let query_str = req.uri().query().unwrap_or_default().to_owned(); let dav_host_str = dav.host().to_owned(); let user_str = user - .as_ref().map_or_else(|| "unknown user".to_owned(), |u| u.login.clone()); + .as_ref() + .map_or_else(|| "unknown user".to_owned(), |u| u.login.clone()); let domain = hostname.split(':').next().unwrap_or_default(); diff --git a/backend/src/dir_server.rs b/backend/src/dir_server.rs index 0a7c468..e92561f 100644 --- a/backend/src/dir_server.rs +++ b/backend/src/dir_server.rs @@ -5,10 +5,11 @@ use crate::{ }; use axum::{ body::Body, - extract::{Host, State}, + extract::State, http::{Request, Response, StatusCode}, response::IntoResponse, }; +use axum_extra::extract::Host; use tower::util::ServiceExt; use tower_http::services::ServeDir; diff --git a/backend/src/main.rs b/backend/src/main.rs index e9a2604..5db2443 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -4,7 +4,8 @@ use atrium::{ mocks::{mock_oauth2_server, mock_proxied_server}, server::Server, }; -use axum::{extract::Host, handler::HandlerWithoutStateExt, response::Redirect, BoxError}; +use axum::{handler::HandlerWithoutStateExt, response::Redirect, BoxError}; +use axum_extra::extract::Host; use axum_server::Handle; use http::{StatusCode, Uri}; use rustls::ServerConfig; @@ -145,13 +146,8 @@ async fn run() -> Result<()> { } #[cfg(feature = "self_signed")] TlsMode::SelfSigned => { - self_signed::serve_with_self_signed_cert( - ip_bind, - &server.port, - handle, - app, - ) - .await?; + self_signed::serve_with_self_signed_cert(ip_bind, &server.port, handle, app) + .await?; } _ => { let addr = format!("{ip_bind}:{}", server.port).parse::()?; diff --git a/backend/src/mocks.rs b/backend/src/mocks.rs index 4e06a3a..e895abe 100644 --- a/backend/src/mocks.rs +++ b/backend/src/mocks.rs @@ -1,11 +1,12 @@ use crate::middlewares::debug_cors_middleware; use axum::{ - extract::{Host, Query}, + extract::Query, middleware, response::{Html, IntoResponse, Redirect}, routing::{get, post}, Extension, Router, }; +use axum_extra::extract::Host; use http::{header, HeaderMap, HeaderValue, StatusCode}; use serde::Deserialize; use tokio::net::TcpListener; diff --git a/backend/src/oauth2.rs b/backend/src/oauth2.rs index 98c63eb..40e1e68 100644 --- a/backend/src/oauth2.rs +++ b/backend/src/oauth2.rs @@ -8,10 +8,13 @@ use crate::{ use anyhow::Result; use axum::{ body::Body, - extract::{ConnectInfo, Host, Query, State}, + extract::{ConnectInfo, Query, State}, response::{IntoResponse, Redirect}, }; -use axum_extra::extract::cookie::{Cookie, CookieJar, PrivateCookieJar}; +use axum_extra::extract::{ + cookie::{Cookie, CookieJar, PrivateCookieJar}, + Host, +}; use http::{header::AUTHORIZATION, HeaderValue, Request, StatusCode, Uri}; use http_body_util::BodyExt; use hyper::body::Buf; diff --git a/backend/src/server.rs b/backend/src/server.rs index cb90904..00cdb99 100644 --- a/backend/src/server.rs +++ b/backend/src/server.rs @@ -68,11 +68,11 @@ impl Server { let admin_router = Router::new() .route("/api/admin/users", get(get_users).post(add_user)) - .route("/api/admin/users/:user_login", delete(delete_user)) + .route("/api/admin/users/{user_login}", delete(delete_user)) .route("/api/admin/apps", get(get_apps).post(add_app)) - .route("/api/admin/apps/:app_id", delete(delete_app)) + .route("/api/admin/apps/{app_id}", delete(delete_app)) .route("/api/admin/davs", get(get_davs).post(add_dav)) - .route("/api/admin/davs/:dav_id", delete(delete_dav)); + .route("/api/admin/davs/{dav_id}", delete(delete_dav)); let main_router = Router::new() .route( diff --git a/backend/src/users.rs b/backend/src/users.rs index 2cbe075..09bbaeb 100644 --- a/backend/src/users.rs +++ b/backend/src/users.rs @@ -12,15 +12,20 @@ use crate::{ }; use argon2::{password_hash::SaltString, Argon2, PasswordHash, PasswordHasher, PasswordVerifier}; use axum::{ - async_trait, body::Body, - extract::{ConnectInfo, FromRef, FromRequestParts, Host, Path, RawQuery, Request, State}, + extract::{ + ConnectInfo, FromRef, FromRequestParts, OptionalFromRequestParts, Path, RawQuery, Request, + State, + }, middleware::Next, response::{IntoResponse, Response}, Extension, Json, RequestPartsExt, }; use axum_extra::{ - extract::cookie::{Cookie, Key, PrivateCookieJar, SameSite}, + extract::{ + cookie::{Cookie, Key, PrivateCookieJar, SameSite}, + Host, + }, TypedHeader, }; use headers::{authorization::Basic, Authorization, HeaderName}; @@ -32,7 +37,7 @@ use http::{ use rand::rngs::OsRng; use serde::{Deserialize, Serialize}; -use std::net::SocketAddr; +use std::{convert::Infallible, net::SocketAddr}; use time::{Duration, OffsetDateTime}; use tracing::info; @@ -123,7 +128,6 @@ impl UserToken { } } -#[async_trait] impl FromRequestParts for UserToken where S: Send + Sync, @@ -134,12 +138,13 @@ where async fn from_request_parts(parts: &mut Parts, state: &S) -> Result { let jar = PrivateCookieJar::from_request_parts(parts, state) .await - .expect("Could not find cookie jar"); + .expect("Cookie jar retrieval is Infallible"); // Get the serialized user_token from the cookie jar, and check the xsrf token if let Some(cookie) = jar.get(AUTH_COOKIE) { if let Ok(TypedHeader(XSRFToken(xsrf_token))) = - TypedHeader::::from_request_parts(parts, state).await + as FromRequestParts>::from_request_parts(parts, state) + .await { // Deserialize the user_token and return him/her let serialized_user_token = cookie.value(); @@ -169,7 +174,10 @@ where // OR Try to get user_token from basic auth headers if let Ok(TypedHeader(Authorization(basic))) = - TypedHeader::>::from_request_parts(parts, state).await + > as FromRequestParts>::from_request_parts( + parts, state, + ) + .await { if let Ok(token) = cookie_from_password(AUTH_COOKIE, &jar, basic.password()) { return Ok(token); @@ -202,6 +210,26 @@ where } } +impl OptionalFromRequestParts for UserToken +where + S: Send + Sync, + Key: FromRef, + ConfigState: FromRef, +{ + type Rejection = Infallible; + + async fn from_request_parts( + parts: &mut Parts, + state: &S, + ) -> Result, Self::Rejection> { + Ok( + >::from_request_parts(parts, state) + .await + .ok(), + ) + } +} + fn cookie_from_password( cookie_name: &str, jar: &PrivateCookieJar, @@ -226,7 +254,6 @@ fn cookie_from_password( #[derive(Serialize, Deserialize)] pub struct AdminToken(UserToken); -#[async_trait] impl FromRequestParts for AdminToken where S: Send + Sync, @@ -235,7 +262,7 @@ where { type Rejection = (StatusCode, &'static str); async fn from_request_parts(parts: &mut Parts, state: &S) -> Result { - let user = UserToken::from_request_parts(parts, state).await?; + let user = >::from_request_parts(parts, state).await?; if !user.roles.contains(&ADMINS_ROLE.to_owned()) { return Err((StatusCode::UNAUTHORIZED, "user is not in admin group")); } @@ -246,7 +273,6 @@ where #[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct UserTokenWithoutXSRFCheck(pub UserToken); -#[async_trait] impl FromRequestParts for UserTokenWithoutXSRFCheck where S: Send + Sync, @@ -256,7 +282,7 @@ where async fn from_request_parts(parts: &mut Parts, state: &S) -> Result { let jar: PrivateCookieJar = PrivateCookieJar::from_request_parts(parts, state) .await - .expect("Could not find cookie jar"); + .expect("Cookie jar retrieval is Infallible"); // Get the serialized user_token from the cookie jar, and check the xsrf token if let Some(cookie) = jar.get(AUTH_COOKIE) { @@ -269,6 +295,25 @@ where } } +impl OptionalFromRequestParts for UserTokenWithoutXSRFCheck +where + S: Send + Sync, + Key: FromRef, +{ + type Rejection = Infallible; + + async fn from_request_parts( + parts: &mut Parts, + state: &S, + ) -> Result, Self::Rejection> { + Ok( + >::from_request_parts(parts, state) + .await + .ok(), + ) + } +} + #[derive(Deserialize)] pub struct LocalAuth { login: String, diff --git a/frontend/android/gradle/wrapper/gradle-wrapper.properties b/frontend/android/gradle/wrapper/gradle-wrapper.properties index e1ca574..ac3b479 100644 --- a/frontend/android/gradle/wrapper/gradle-wrapper.properties +++ b/frontend/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip diff --git a/frontend/android/settings.gradle b/frontend/android/settings.gradle index ec78ae0..2d7aa46 100644 --- a/frontend/android/settings.gradle +++ b/frontend/android/settings.gradle @@ -19,7 +19,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false + id "com.android.application" version "8.1.0" apply false id "org.jetbrains.kotlin.android" version "1.9.25" apply false } diff --git a/frontend/lib/components/explorer.dart b/frontend/lib/components/explorer.dart index eeaf235..ef1cd16 100644 --- a/frontend/lib/components/explorer.dart +++ b/frontend/lib/components/explorer.dart @@ -525,17 +525,17 @@ class ExplorerState extends State { return SizedBox( width: 30, height: 30, - child: FutureBuilder( + child: FutureBuilder( future: client .read(file.path!, cancelToken: cancelToken) - .then((value) => Uint8List.fromList(value)), - builder: - (BuildContext context, AsyncSnapshot snapshot) { + .then((value) => MemoryImage(Uint8List.fromList(value))), + builder: (BuildContext context, + AsyncSnapshot snapshot) { if (snapshot.hasData) { return Center( child: Image( - image: ResizeImage(MemoryImage(snapshot.data!), - width: 30))); + image: snapshot.data!, + )); } else { return const Icon(Icons.image, size: 30); } @@ -676,7 +676,7 @@ class ExplorerSearchDelegate extends SearchDelegate { @override Widget buildResults(BuildContext context) { - throw UnimplementedError(); + return buildSuggestions(context); } } diff --git a/frontend/lib/components/iframe_webview.dart b/frontend/lib/components/iframe_webview.dart index ee1f0bc..bc8c8ee 100644 --- a/frontend/lib/components/iframe_webview.dart +++ b/frontend/lib/components/iframe_webview.dart @@ -5,7 +5,7 @@ import 'dart:html'; import 'package:flutter/widgets.dart'; -import 'dart:ui' as ui; +import 'dart:ui_web' as ui; class AppWebView extends StatefulWidget { final String initialUrl; @@ -36,8 +36,8 @@ class _AppWebViewState extends State { ui.platformViewRegistry.registerViewFactory( viewId.toString(), (int id) => IFrameElement() - ..width = MediaQuery.of(context).size.width.toString() - ..height = MediaQuery.of(context).size.height.toString() + ..style.width = '100%' + ..style.height = '100%' ..src = widget.initialUrl ..id = viewId ..style.border = 'none'); diff --git a/frontend/lib/models/app.dart b/frontend/lib/models/app.dart index 6a03cf8..e38b5a1 100644 --- a/frontend/lib/models/app.dart +++ b/frontend/lib/models/app.dart @@ -75,7 +75,7 @@ class AppModel implements Model { data['id'] = id; data['name'] = name; data['icon'] = icon; - data['color'] = color.value; + data['color'] = color.value; // TODO : replace with toARGB32 method when available data['is_proxy'] = isProxy; data['insecure_skip_verify'] = insecureSkipVerify; data['host'] = host; diff --git a/frontend/lib/platform/web.dart b/frontend/lib/platform/web.dart index 4532e4a..5815c6a 100644 --- a/frontend/lib/platform/web.dart +++ b/frontend/lib/platform/web.dart @@ -10,16 +10,14 @@ import 'package:flutter/material.dart'; import 'package:webdav_client/webdav_client.dart' as webdav; import 'package:atrium/models/api_provider.dart'; -class NotificationsPlugin { - -} +class NotificationsPlugin {} // Create new client configured for web webdav.Client newExplorerClient(String uri, {String user = '', String password = '', bool debug = false}) { var client = webdav.newClient(uri, user: user, password: password, debug: debug); - var adapter = BrowserHttpClientAdapter(); + var adapter = HttpClientAdapter() as BrowserHttpClientAdapter; adapter.withCredentials = true; client.c.httpClientAdapter = adapter; client.c.interceptors.add(QueuedInterceptorsWrapper( @@ -36,7 +34,7 @@ webdav.Client newExplorerClient(String uri, Dio newDio(BaseOptions options) { var dio = Dio(options); - var adapter = BrowserHttpClientAdapter(); + var adapter = HttpClientAdapter() as BrowserHttpClientAdapter; adapter.withCredentials = true; dio.httpClientAdapter = adapter; return dio; diff --git a/frontend/lib/utils.dart b/frontend/lib/utils.dart index ecb0755..21a07a9 100644 --- a/frontend/lib/utils.dart +++ b/frontend/lib/utils.dart @@ -33,9 +33,13 @@ FileType fileTypeFromExt(String ext) { "txt", "yaml", "yml", - ].contains(ext)) return FileType.text; + ].contains(ext)) { + return FileType.text; + } if (["docx", "doc", "odt", "xlsx", "xls", "ods", "pptx", "ppt", "opd"] - .contains(ext)) return FileType.document; + .contains(ext)) { + return FileType.document; + } if ([ "apng", "avif", @@ -53,7 +57,9 @@ FileType fileTypeFromExt(String ext) { "tif", "tiff", "webp" - ].contains(ext)) return FileType.image; + ].contains(ext)) { + return FileType.image; + } if (["mp3", "wav", "ogg", "mp4", "avi", "mkv", "m4v", "webm"].contains(ext)) { return FileType.media; } diff --git a/frontend/pubspec.lock b/frontend/pubspec.lock index af724d4..1d9fc1b 100644 --- a/frontend/pubspec.lock +++ b/frontend/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: archive - sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + sha256: "6199c74e3db4fbfbd04f66d739e72fe11c8a8957d5f219f1f4482dbde6420b5a" url: "https://pub.dev" source: hosted - version: "3.6.1" + version: "4.0.2" args: dependency: transitive description: @@ -69,10 +69,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" convert: dependency: transitive description: @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: device_info_plus_platform_interface - sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba" + sha256: "0b04e02b30791224b31969eb1b50d723498f402971bff3630bca2ba839bd1ed2" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "7.0.2" dio: dependency: "direct main" description: @@ -181,10 +181,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: "16dc141db5a2ccc6520ebb6a2eb5945b1b09e95085c021d9f914f8ded7f1465c" + sha256: c904b4ab56d53385563c7c39d8e9fa9af086f91495dfc48717ad84a42c3cf204 url: "https://pub.dev" source: hosted - version: "8.1.4" + version: "8.1.7" filesize: dependency: "direct main" description: @@ -263,10 +263,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "9b78450b89f059e96c9ebb355fa6b3df1d6b330436e0b885fb49594c41721398" + sha256: "615a505aef59b151b46bbeef55b36ce2b6ed299d160c51d84281946f0aa0ce0e" url: "https://pub.dev" source: hosted - version: "2.0.23" + version: "2.0.24" flutter_test: dependency: "direct dev" description: flutter @@ -297,18 +297,18 @@ packages: dependency: transitive description: name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.1.2" image: dependency: transitive description: name: image - sha256: f31d52537dc417fdcde36088fdf11d191026fd5e4fae742491ebd40e5a8bea7d + sha256: "8346ad4b5173924b5ddddab782fc7d8a6300178c8b1dc427775405a01701c4a6" url: "https://pub.dev" source: hosted - version: "4.3.0" + version: "4.5.2" intl: dependency: transitive description: @@ -329,18 +329,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.7" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.8" leak_tracker_testing: dependency: transitive description: @@ -353,10 +353,10 @@ packages: dependency: transitive description: name: lints - sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413" + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.1.1" matcher: dependency: transitive description: @@ -549,6 +549,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + posix: + dependency: transitive + description: + name: posix + sha256: a0117dc2167805aa9125b82eee515cc891819bac2f538c83646d355b16f58b9a + url: "https://pub.dev" + source: hosted + version: "6.0.1" provider: dependency: "direct main" description: @@ -569,26 +577,26 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: "95f9997ca1fb9799d494d0cb2a780fd7be075818d59f00c43832ed112b158a82" + sha256: a752ce92ea7540fc35a0d19722816e04d0e72828a4200e83a98cf1a1eb524c9a url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.3.5" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "7f172d1b06de5da47b6264c2692ee2ead20bbbc246690427cdb4fc301cd0c549" + sha256: "02a7d8a9ef346c9af715811b01fbd8e27845ad2c41148eefd31321471b41863d" url: "https://pub.dev" source: hosted - version: "2.3.4" + version: "2.4.0" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "07e050c7cd39bad516f8d64c455f04508d09df104be326d8c02551590a0d513d" + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.5.4" shared_preferences_linux: dependency: transitive description: @@ -625,7 +633,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -646,10 +654,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.0" stream_channel: dependency: transitive description: @@ -662,10 +670,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" synchronized: dependency: transitive description: @@ -686,10 +694,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.3" timezone: dependency: transitive description: @@ -814,10 +822,10 @@ packages: dependency: transitive description: name: video_player_avfoundation - sha256: f498e44a547a3572a928fa30ac8760e127d5e5fc86b81b10b0d56300866322f3 + sha256: "33224c19775fd244be2d6e3dbd8e1826ab162877bd61123bf71890772119a2b7" url: "https://pub.dev" source: hosted - version: "2.6.4" + version: "2.6.5" video_player_platform_interface: dependency: transitive description: @@ -838,10 +846,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.3.0" web: dependency: transitive description: @@ -879,10 +887,10 @@ packages: dependency: "direct main" description: name: webview_flutter_android - sha256: "285cedfd9441267f6cca8843458620b5fda1af75b04f5818d0441acda5d7df19" + sha256: "3d535126f7244871542b2f0b0fcf94629c9a14883250461f9abe1a6644c1c379" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.2.0" webview_flutter_platform_interface: dependency: transitive description: @@ -903,10 +911,10 @@ packages: dependency: transitive description: name: win32 - sha256: "8b338d4486ab3fbc0ba0db9f9b4f5239b6697fcee427939a40e720cbb9ee0a69" + sha256: "154360849a56b7b67331c21f09a386562d88903f90a1099c5987afc1912e1f29" url: "https://pub.dev" source: hosted - version: "5.9.0" + version: "5.10.0" win32_registry: dependency: transitive description: @@ -935,10 +943,10 @@ packages: dependency: transitive description: name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.3" sdks: - dart: ">=3.5.0 <4.0.0" + dart: ">=3.6.0 <4.0.0" flutter: ">=3.24.0" diff --git a/frontend/pubspec.yaml b/frontend/pubspec.yaml index 1a87900..4d5c9ea 100644 --- a/frontend/pubspec.yaml +++ b/frontend/pubspec.yaml @@ -34,19 +34,19 @@ dependencies: sdk: flutter dio: ^5.7.0 - file_picker: ^8.1.4 + file_picker: ^8.1.7 filesize: ^2.0.1 flutter_colorpicker: ^1.1.0 flutter_local_notifications: ^18.0.1 path_provider: ^2.1.5 pdfx: ^2.8.0 provider: ^6.1.2 - shared_preferences: ^2.3.3 + shared_preferences: ^2.3.5 url_launcher: ^6.3.1 video_player: ^2.9.2 webdav_client: ^1.2.2 webview_flutter: ^4.10.0 - webview_flutter_android: ^4.1.0 + webview_flutter_android: ^4.2.0 # TEMPORARY webview_cookie_manager: git: https://github.com/fryette/webview_cookie_manager.git @@ -57,7 +57,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_launcher_icons: ^0.14.1 + flutter_launcher_icons: ^0.14.2 # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is