Compare commits
2 Commits
3a25a8b812
...
db01332c15
Author | SHA1 | Date |
---|---|---|
trivernis | db01332c15 | 3 months ago |
trivernis | 7047dc7903 | 3 months ago |
@ -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"
|
File diff suppressed because it is too large
Load Diff
@ -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"] }
|
@ -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,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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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…
Reference in New Issue