Compare commits

...

2 Commits

@ -0,0 +1,11 @@
[language-server.rust-analyzer]
command = "rust-analyzer"
[language-server.rust-analyzer.config]
inlayHints.bindingModeHints.enable = false
inlayHints.closingBraceHints.minLines = 10
inlayHints.closureReturnTypeHints.enable = "with_block"
inlayHints.discriminantHints.enable = "fieldless"
inlayHints.lifetimeElisionHints.enable = "skip_trivial"
inlayHints.typeHints.hideClosureInitialization = false
cargo.features = "all"

@ -1,6 +1,6 @@
[package]
name = "mediarepo-api"
version = "0.32.1"
version = "0.33.0"
edition = "2018"
license = "gpl-3"
@ -20,7 +20,7 @@ url = { version = "2.2.2", optional = true }
pathsearch = { version = "0.2.0", optional = true }
[dependencies.bromine]
version = "0.20.1"
version = "0.22.1"
optional = true
features = ["serialize_bincode", "encryption_layer"]
@ -33,7 +33,7 @@ version = "0.4.19"
features = ["serde"]
[dependencies.tauri]
version = "1.0.0-rc.4"
version = "1.5.4"
optional = true
default-features = false
features = []

@ -1,22 +1,22 @@
pub mod error;
pub mod file;
pub mod job;
pub mod preset;
pub mod protocol;
pub mod repo;
pub mod tag;
pub mod preset;
use crate::client_api::error::{ApiError, ApiResult};
use crate::client_api::file::FileApi;
use crate::client_api::job::JobApi;
use crate::client_api::preset::PresetApi;
use crate::client_api::repo::RepoApi;
use crate::client_api::tag::TagApi;
use crate::types::misc::{check_apis_compatible, get_api_version, InfoResponse};
use async_trait::async_trait;
use bromine::prelude::*;
use bromine::prelude::emit_metadata::EmitMetadata;
use bromine::prelude::*;
use tokio::time::Duration;
use crate::client_api::preset::PresetApi;
#[async_trait]
pub trait IPCApi {

@ -57,7 +57,10 @@ fn once_scheme<R: Runtime>(app: &AppHandle<R>, request: &Request) -> Result<Resp
#[tracing::instrument(level = "debug", skip_all)]
async fn content_scheme<R: Runtime>(app: &AppHandle<R>, request: &Request) -> Result<Response> {
let buf_state = app.state::<BufferState>();
let hash = request.uri().trim_start_matches("content://");
let hash = request
.uri()
.trim_start_matches("content://")
.trim_end_matches("/");
if let Some(buffer) = buf_state.get_entry(hash) {
tracing::debug!("Fetching content from cache");

@ -5,8 +5,9 @@ use std::time::{SystemTime, UNIX_EPOCH};
pub fn system_time_to_naive_date_time(system_time: SystemTime) -> NaiveDateTime {
let epoch_duration = system_time.duration_since(UNIX_EPOCH).unwrap();
NaiveDateTime::from_timestamp(
NaiveDateTime::from_timestamp_opt(
epoch_duration.as_secs() as i64,
epoch_duration.subsec_nanos(),
)
.unwrap()
}

File diff suppressed because it is too large Load Diff

@ -4,7 +4,7 @@ default-members = ["mediarepo-core", "mediarepo-database", "mediarepo-logic", "m
[package]
name = "mediarepo-daemon"
version = "1.0.4"
version = "1.0.5"
edition = "2018"
license = "gpl-3"
repository = "https://github.com/Trivernis/mediarepo-daemon"
@ -45,7 +45,7 @@ path = "./mediarepo-socket"
path = "./mediarepo-worker"
[dependencies.tokio]
version = "1.17.0"
version = "1.21.2"
features = ["macros", "rt-multi-thread", "io-std", "io-util"]
[dependencies.tracing-subscriber]

@ -34,7 +34,7 @@ default-features = false
features = ["migrate"]
[dependencies.tokio]
version = "1.17.0"
version = "1.21.2"
features = ["fs", "io-util", "io-std"]
[dependencies.config]

@ -26,6 +26,6 @@ features = ["runtime-tokio-native-tls", "macros"]
default-features = false
[dependencies.tokio]
version = "1.17.0"
version = "1.21.2"
features = ["fs", "io-std", "io-util"]

@ -26,8 +26,8 @@ path = "../mediarepo-logic"
path = "../mediarepo-worker"
[dependencies.tokio]
version = "1.17.0"
features = ["net"]
version = "1.21.2"
features = ["net", "rt", "tracing"]
[dependencies.chrono]
version = "0.4.19"

@ -38,17 +38,15 @@ pub fn start_tcp_server(
let address = SocketAddr::new(ip, port);
let address_string = address.to_string();
let join_handle = tokio::task::Builder::new()
.name("mediarepo_tcp::listen")
.spawn(async move {
get_builder::<EncryptedListener<TcpListener>>(address)
.insert::<SubsystemKey>(subsystem)
.insert_all(shared_data)
.insert::<SizeMetadataKey>(Default::default())
.build_server()
.await
.expect("Failed to start tcp server")
});
let join_handle = tokio::task::spawn(async move {
get_builder::<EncryptedListener<TcpListener>>(address)
.insert::<SubsystemKey>(subsystem)
.insert_all(shared_data)
.insert::<SizeMetadataKey>(Default::default())
.build_server()
.await
.expect("Failed to start tcp server")
});
Ok((address_string, join_handle))
}
@ -66,17 +64,15 @@ pub fn create_unix_socket(
if path.exists() {
fs::remove_file(&path)?;
}
let join_handle = tokio::task::Builder::new()
.name("mediarepo_unix_socket::listen")
.spawn(async move {
get_builder::<UnixListener>(path)
.insert::<SubsystemKey>(subsystem)
.insert_all(shared_data)
.insert::<SizeMetadataKey>(Default::default())
.build_server()
.await
.expect("Failed to create unix domain socket");
});
let join_handle = tokio::task::spawn(async move {
get_builder::<UnixListener>(path)
.insert::<SubsystemKey>(subsystem)
.insert_all(shared_data)
.insert::<SizeMetadataKey>(Default::default())
.build_server()
.await
.expect("Failed to create unix domain socket");
});
Ok(join_handle)
}

@ -19,7 +19,7 @@ path = "../mediarepo-logic"
path = "../mediarepo-database"
[dependencies.tokio]
version = "1.17.0"
version = "1.21.2"
features = ["macros"]
[dependencies.chrono]

@ -1,66 +1,57 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"quotes": [
"warn",
"double",
{
"avoidEscape": true
}
],
"indent": [
"error",
4,
{
"SwitchCase": 1
}
],
"no-unused-expressions": "warn",
"semi": "error"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
]
"root": true,
"ignorePatterns": ["projects/**/*"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"quotes": [
"warn",
"double",
{
"avoidEscape": true
}
],
"indent": [
"error",
4,
{
"SwitchCase": 1
}
],
"no-unused-expressions": "warn",
"no-extraneous-class": "off",
"semi": "error"
}
},
{
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {}
}
]
}

@ -0,0 +1,15 @@
[language-server.biome]
command = "biome"
args = ["lsp-proxy"]
[[language]]
name = "typescript"
language-servers = ["typescript-language-server"]
auto-format = true
formatter = { command = "biome" , args = ["format", "--stdin-file-path=file.ts"] }
[[language]]
name = "javascript"
language-servers = ["typescript-language-server", "biome"]
auto-format = true
formatter = { command = "biome" , args = ["format", "--stdin-file-path=file.js"] }

@ -3,7 +3,8 @@
"version": 1,
"cli": {
"packageManager": "yarn",
"defaultCollection": "@angular-eslint/schematics"
"defaultCollection": "@angular-eslint/schematics",
"analytics": "dc09bab7-b1ef-4661-8d46-1da5b61c8e44"
},
"newProjectRoot": "projects",
"projects": {

@ -0,0 +1,15 @@
{
"$schema": "https://biomejs.dev/schemas/1.3.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noStaticOnlyClass": "off"
}
}
}
}

@ -1,63 +1,64 @@
{
"name": "mediarepo-ui",
"version": "1.0.4",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"watch-prod": "ng build --watch --configuration production",
"test": "ng test",
"lint": "ng lint",
"tauri": "tauri"
},
"private": true,
"dependencies": {
"@angular/animations": "~13.3.2",
"@angular/cdk": "^13.3.2",
"@angular/common": "~13.3.2",
"@angular/compiler": "~13.3.2",
"@angular/core": "~13.3.2",
"@angular/flex-layout": "^13.0.0-beta.36",
"@angular/forms": "~13.3.2",
"@angular/material": "^13.3.2",
"@angular/platform-browser": "~13.3.2",
"@angular/platform-browser-dynamic": "~13.3.2",
"@angular/router": "~13.3.2",
"@ng-icons/core": "^15.1.0",
"@ng-icons/feather-icons": "^15.1.0",
"@ng-icons/material-icons": "^15.1.0",
"@tauri-apps/api": "^1.0.0-rc.3",
"chart.js": "^3.7.1",
"primeicons": "^5.0.0",
"primeng": "^13.3.2",
"rxjs": "~7.5.5",
"tslib": "^2.3.1",
"w3c-keys": "^1.0.3",
"zone.js": "~0.11.5"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.3.2",
"@angular-eslint/builder": "^13.2.0",
"@angular-eslint/eslint-plugin": "^13.2.0",
"@angular-eslint/eslint-plugin-template": "^13.2.0",
"@angular-eslint/schematics": "^13.2.0",
"@angular-eslint/template-parser": "^13.2.0",
"@angular/cli": "~13.3.2",
"@angular/compiler-cli": "~13.3.2",
"@tauri-apps/cli": "^1.0.0-rc.8",
"@types/file-saver": "^2.0.4",
"@types/jasmine": "~4.0.2",
"@types/node": "^17.0.23",
"@typescript-eslint/eslint-plugin": "5.19.0",
"@typescript-eslint/parser": "^5.19.0",
"eslint": "^8.13.0",
"jasmine-core": "~4.0.0",
"karma": "~6.3.10",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~4.0.2",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.6.3"
}
"name": "mediarepo-ui",
"version": "1.0.5",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"watch-prod": "ng build --watch --configuration production",
"test": "ng test",
"lint": "ng lint",
"tauri": "tauri"
},
"private": true,
"dependencies": {
"@angular/animations": "~13.3.2",
"@angular/cdk": "^13.3.2",
"@angular/common": "~13.3.2",
"@angular/compiler": "~13.3.2",
"@angular/core": "~13.3.2",
"@angular/flex-layout": "^13.0.0-beta.36",
"@angular/forms": "~13.3.2",
"@angular/material": "^13.3.2",
"@angular/platform-browser": "~13.3.2",
"@angular/platform-browser-dynamic": "~13.3.2",
"@angular/router": "~13.3.2",
"@ng-icons/core": "^15.1.0",
"@ng-icons/feather-icons": "^15.1.0",
"@ng-icons/material-icons": "^15.1.0",
"@tauri-apps/api": "^1.5.3",
"chart.js": "^3.7.1",
"primeicons": "^5.0.0",
"primeng": "^13.3.2",
"rxjs": "~7.5.5",
"tslib": "^2.3.1",
"w3c-keys": "^1.0.3",
"zone.js": "~0.11.5"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.3.2",
"@angular-eslint/builder": "^13.2.0",
"@angular-eslint/eslint-plugin": "^13.2.0",
"@angular-eslint/eslint-plugin-template": "^13.2.0",
"@angular-eslint/schematics": "^13.2.0",
"@angular-eslint/template-parser": "^13.2.0",
"@angular/cli": "~13.3.2",
"@angular/compiler-cli": "~13.3.2",
"@angular/language-service": "^17.1.1",
"@tauri-apps/cli": "^1.5.4",
"@types/file-saver": "^2.0.4",
"@types/jasmine": "~4.0.2",
"@types/node": "^17.0.23",
"@typescript-eslint/eslint-plugin": "5.19.0",
"@typescript-eslint/parser": "^5.19.0",
"eslint": "^8.13.0",
"jasmine-core": "~4.0.0",
"karma": "~6.3.10",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~4.0.2",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.6.3"
}
}

File diff suppressed because it is too large Load Diff

@ -1,16 +1,16 @@
[package]
name = "app"
version = "1.0.4"
version = "1.0.5"
description = "The UI for the mediarepo media management tool"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2018"
edition = "2021"
build = "src/build.rs"
[build-dependencies]
tauri-build = { version = "1.0.0-rc.5", features = [] }
tauri-build = { version = "1.5.1", features = [] }
[dependencies]
serde_json = "1.0.79"
@ -19,7 +19,7 @@ thiserror = "1.0.30"
typemap_rev = "0.1.5"
[dependencies.tauri]
version = "1.0.0-rc.6"
version = "1.5.4"
features = ["dialog-all", "path-all", "shell-all"]
[dependencies.tracing-subscriber]

@ -1,76 +1,74 @@
{
"package": {
"productName": "mediarepo-ui",
"version": "1.0.4"
},
"build": {
"distDir": "../dist/mediarepo-ui",
"devPath": "http://localhost:4200",
"beforeDevCommand": "yarn start",
"beforeBuildCommand": "yarn build"
},
"tauri": {
"bundle": {
"active": true,
"targets": "all",
"identifier": "net.trivernis.mediarepo",
"icon": [
"icons/32x32.png",
"icons/64x64.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.ico",
"icons/icon.icns"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "Productivity",
"shortDescription": "A media management tool",
"longDescription": "",
"deb": {
"depends": [],
"useBootstrapper": false
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
"entitlements": null
},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"updater": {
"active": false
},
"allowlist": {
"dialog": {
"all": true
},
"shell": {
"all": true
},
"path": {
"all": true
}
},
"windows": [
{
"title": "mediarepo",
"width": 1920,
"height": 1080,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": null
}
}
"package": {
"productName": "mediarepo-ui",
"version": "1.0.4"
},
"build": {
"distDir": "../dist/mediarepo-ui",
"devPath": "http://localhost:4200",
"beforeDevCommand": "yarn start",
"beforeBuildCommand": "yarn build"
},
"tauri": {
"bundle": {
"active": true,
"targets": ["msi", "app", "dmg", "updater"],
"identifier": "net.trivernis.mediarepo",
"icon": [
"icons/32x32.png",
"icons/64x64.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.ico",
"icons/icon.icns"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "Productivity",
"shortDescription": "A media management tool",
"longDescription": "",
"deb": {
"depends": []
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"exceptionDomain": "",
"signingIdentity": null,
"entitlements": null
},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"updater": {
"active": false
},
"allowlist": {
"dialog": {
"all": true
},
"shell": {
"all": true
},
"path": {
"all": true
}
},
"windows": [
{
"title": "mediarepo",
"width": 1920,
"height": 1080,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": null
}
}
}

@ -21,7 +21,7 @@ export class ContextMenuComponent {
event.preventDefault();
this.x = event.clientX + "px";
this.y = event.clientY + "px";
this.menuTrigger.menu.focusFirstItem("mouse");
this.menuTrigger.menu?.focusFirstItem("mouse");
this.menuTrigger.openMenu();
this.changeDetector.markForCheck();
}

@ -23,11 +23,11 @@ export class AddRepositoryDialogComponent {
public async checkLocalRepoExists() {
this.repositoryForm.localRepoExists = await this.repoService.checkLocalRepositoryExists(
this.repositoryForm.formGroup.value.path);
this.repositoryForm.formGroup.value.path as unknown as string);
}
public async initLocalRepository() {
const path = this.repositoryForm.formGroup.value.path;
const path = this.repositoryForm.formGroup.value.path as unknown as string;
try {
await this.repoService.initRepository(path);
} catch (err: any) {
@ -37,7 +37,7 @@ export class AddRepositoryDialogComponent {
}
public async addRepository() {
let { name, repositoryType, path, address } = this.repositoryForm.formGroup.value;
let { name, repositoryType, path, address } = this.repositoryForm.formGroup.value as unknown as any;
path = repositoryType === "local" ? path : undefined;
address = repositoryType === "remote" ? address : undefined;
try {

@ -1,65 +1,71 @@
import {downloadDir} from "@tauri-apps/api/path";
import {dialog} from "@tauri-apps/api";
import {File} from "../../../api/models/File";
import { downloadDir } from "@tauri-apps/api/path";
import { dialog } from "@tauri-apps/api";
import type { File } from "../../../api/models/File";
export class FileHelper {
/**
* Opens a dialog to get a download location for the given file
* @param {File} file
*/
public static async getFileDownloadLocation(
file: File,
): Promise<string | null> {
let extension = FileHelper.getExtensionForMime(file.mimeType);
/**
* Opens a dialog to get a download location for the given file
* @param {File} file
*/
public static async getFileDownloadLocation(file: File): Promise<string | undefined> {
let extension = FileHelper.getExtensionForMime(file.mimeType);
const downloadDirectory = await downloadDir();
const suggestionPath = downloadDirectory + file.cd + "." + extension;
const downloadDirectory = await downloadDir();
const suggestionPath = downloadDirectory + file.cd + "." + extension;
return await dialog.save({
defaultPath: suggestionPath,
filters: [
{
name: file.mimeType,
extensions: [extension ?? "*"],
},
{ name: "All", extensions: ["*"] },
],
});
}
return await dialog.save({
defaultPath: suggestionPath,
filters: [{
name: file.mimeType,
extensions: [extension ?? "*"]
}, { name: "All", extensions: ["*"] }]
});
}
/**
* Parses a mime into its two components
* @param {string | undefined} mimeType
* @returns {[string, string] | undefined}
*/
public static parseMime(
mimeType: string | undefined,
): [string, string] | undefined {
if (!mimeType) {
return undefined;
}
let mimeParts = mimeType.split("/");
if (mimeParts.length < 2) {
return undefined;
}
const type = mimeParts[0];
const subtype = mimeParts[1];
/**
* Parses a mime into its two components
* @param {string | undefined} mimeType
* @returns {[string, string] | undefined}
*/
public static parseMime(mimeType: string | undefined): [string, string] | undefined {
if (!mimeType) {
return undefined;
}
let mimeParts = mimeType.split("/");
if (mimeParts.length < 2) {
return undefined;
}
const type = mimeParts[0];
const subtype = mimeParts[1];
return [type, subtype];
}
return [type, subtype];
}
/**
* Returns the extension for a mime type
* @param {string} mime
* @returns {string | undefined}
* @private
*/
public static getExtensionForMime(mime: string): string | undefined {
let parts = mime.split("/");
/**
* Returns the extension for a mime type
* @param {string} mime
* @returns {string | undefined}
* @private
*/
public static getExtensionForMime(mime: string): string | undefined {
let parts = mime.split("/");
if (parts.length === 2) {
const type = parts[0];
const subtype = parts[1];
return FileHelper.convertMimeSubtypeToExtension(subtype);
}
return undefined;
}
if (parts.length === 2) {
const type = parts[0];
const subtype = parts[1];
return FileHelper.convertMimeSubtypeToExtension(subtype);
}
return undefined;
}
private static convertMimeSubtypeToExtension(subtype: string): string {
return subtype;
}
private static convertMimeSubtypeToExtension(subtype: string): string {
return subtype;
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save