Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 10 additions & 3 deletions backend/src/applications/files/constants/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ export const DEFAULT_CHECKSUM_ALGORITHM = 'sha512-256'
export const DEFAULT_HIGH_WATER_MARK = 1024 * 1024
export const DEFAULT_MIME_TYPE = 'application/octet-stream'
export const EXTRA_MIMES_TYPE = new Map([
['.ts', 'text-typescript'],
['.go', 'text-x-go'],
['.gz', 'application-gzip'],
['.gzip', 'application-gzip'],
['.patch', 'text-x-patch'],
['.ps1', 'text-x-powershell'],
['.py', 'text-x-python'],
['.pyc', 'application-x-python-code'],
['.rb', 'text-x-ruby'],
['.rs', 'text-rust'],
['.tgz', 'application-gzip'],
['.gz', 'application-gzip'],
['.gzip', 'application-gzip']
['.ts', 'text-typescript'],
['.xcf', 'image-x-xcf']
])
export const COMPRESSION_EXTENSION = new Map([
['.zip', 'zip'],
Expand Down
9 changes: 9 additions & 0 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
},
"configurations": {
"production": {
"assets": [
"src/favicon.ico",
{
"glob": "**/*",
"input": "src/assets",
"output": "assets",
"ignore": ["mimes/**"]
}
],
"budgets": [
{
"type": "initial",
Expand Down
6 changes: 3 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"license": "AGPL-3.0-or-later",
"private": true,
"scripts": {
"build-assets": "node scripts/build-assets.mjs",
"prewatch": "NODE_ENV=development npm run build-assets",
"prebuild": "npm run build-assets",
"prewatch": "NODE_ENV=development npm run prebuild",
"prebuild": "node scripts/prebuild.mjs",
"postbuild": "node scripts/postbuild.mjs",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
Expand Down
23 changes: 23 additions & 0 deletions frontend/scripts/copy-mimes-dir.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import fs from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

export async function copyMimesForProd() {
const srcDir = path.join(__dirname, '..', '..', 'frontend', 'src', 'assets', 'mimes')
const destDir = path.join(__dirname, '..', '..', 'dist', 'static', 'assets', 'mimes')

try {
// Copy mimes directory in order to keep relative symlinks
await fs.cp(srcDir, destDir, {
recursive: true,
verbatimSymlinks: true
})
console.log('postbuild - mimes directory copied succesfully')
} catch (err) {
console.error('postbuild - Error with mimes copy:', err)
process.exit(1)
}
}
6 changes: 6 additions & 0 deletions frontend/scripts/postbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { copyMimesForProd } from './copy-mimes-dir.mjs'

if (process.env.NODE_ENV !== 'development') {
console.log('fix assets ...')
await copyMimesForProd()
}
File renamed without changes.
14 changes: 0 additions & 14 deletions frontend/src/assets/mimes/7zip.svg

This file was deleted.

14 changes: 0 additions & 14 deletions frontend/src/assets/mimes/application-7zip.svg

This file was deleted.

15 changes: 0 additions & 15 deletions frontend/src/assets/mimes/application-atom.svg

This file was deleted.

Loading