upgrade everything

This commit is contained in:
rubikscraft 2022-08-26 12:38:05 +02:00
parent d507fcfaf0
commit 659a41cd28
No known key found for this signature in database
GPG Key ID: 1463EBE9200A5CD4
21 changed files with 13601 additions and 8701 deletions

10
.editorconfig Normal file
View File

@ -0,0 +1,10 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2

8
.gitignore vendored
View File

@ -1,3 +1,11 @@
node_modules node_modules
todo.txt todo.txt
yarn-error.log yarn-error.log
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
v18.8

26
.vscode/tasks.json vendored
View File

@ -18,7 +18,11 @@
"label": "Start shared", "label": "Start shared",
"command": "yarn start", "command": "yarn start",
"options": { "options": {
"cwd": "${cwd}/shared" "cwd": "${cwd}/shared",
"shell": {
"executable": "/bin/bash",
"args": ["-i", "-c"]
}
}, },
"group": "build" "group": "build"
}, },
@ -27,7 +31,11 @@
"label": "Start backend", "label": "Start backend",
"command": "yarn start:dev", "command": "yarn start:dev",
"options": { "options": {
"cwd": "${cwd}/backend" "cwd": "${cwd}/backend",
"shell": {
"executable": "/bin/bash",
"args": ["-i", "-c"]
}
}, },
"group": "build" "group": "build"
}, },
@ -36,16 +44,24 @@
"label": "Start frontend", "label": "Start frontend",
"command": "yarn watch", "command": "yarn watch",
"options": { "options": {
"cwd": "${cwd}/frontend" "cwd": "${cwd}/frontend",
"shell": {
"executable": "/bin/bash",
"args": ["-i", "-c"]
}
}, },
"group": "build" "group": "build"
}, },
{ {
"type": "shell", "type": "shell",
"label": "Start postgres", "label": "Start postgres",
"command": "podman-compose -f ./dev.docker-compose.yml stop; podman-compose -f ./dev.docker-compose.yml up", "command": "yarn devdb:start",
"options": { "options": {
"cwd": "${cwd}/support" "cwd": "${cwd}",
"shell": {
"executable": "/bin/bash",
"args": ["-i", "-c"]
}
}, },
"group": "build" "group": "build"
} }

File diff suppressed because one or more lines are too long

783
.yarn/releases/yarn-berry.cjs vendored Executable file

File diff suppressed because one or more lines are too long

3
.yarn/versions/24850e5c.yml vendored Normal file
View File

@ -0,0 +1,3 @@
undecided:
- root-workspace-0b6124
- "@skala/web-backend"

7
.yarnrc.yml Normal file
View File

@ -0,0 +1,7 @@
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-berry.cjs

View File

@ -1,6 +1,5 @@
{ {
"name": "picsur-backend", "name": "picsur-backend",
"private": false,
"version": "0.3.0", "version": "0.3.0",
"description": "Backend for Picsur", "description": "Backend for Picsur",
"license": "GPL-3.0", "license": "GPL-3.0",
@ -23,62 +22,62 @@
"dependencies": { "dependencies": {
"@fastify/helmet": "^9.1.0", "@fastify/helmet": "^9.1.0",
"@fastify/multipart": "^7.1.0", "@fastify/multipart": "^7.1.0",
"@fastify/static": "^6.4.0", "@fastify/static": "^6.5.0",
"@nestjs/common": "^8.4.7", "@nestjs/common": "^9.0.11",
"@nestjs/config": "^2.1.0", "@nestjs/config": "^2.2.0",
"@nestjs/core": "^8.4.7", "@nestjs/core": "^9.0.11",
"@nestjs/jwt": "^8.0.1", "@nestjs/jwt": "^9.0.0",
"@nestjs/passport": "^8.2.2", "@nestjs/passport": "^9.0.0",
"@nestjs/platform-fastify": "^8.4.7", "@nestjs/platform-fastify": "^9.0.11",
"@nestjs/serve-static": "^2.2.2", "@nestjs/serve-static": "^3.0.0",
"@nestjs/typeorm": "^8.1.4", "@nestjs/typeorm": "^9.0.1",
"bcrypt": "^5.0.1", "bcrypt": "^5.0.1",
"bmp-img": "^1.1.0", "bmp-img": "^1.1.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"fastify-static": "^4.7.0", "fastify-static": "^4.7.0",
"file-type": "^17.1.2", "file-type": "^18.0.0",
"ms": "^2.1.3", "ms": "^2.1.3",
"p-timeout": "^5.1.0", "p-timeout": "^6.0.0",
"passport": "^0.6.0", "passport": "^0.6.0",
"passport-jwt": "^4.0.0", "passport-jwt": "^4.0.0",
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"passport-strategy": "^1.0.0", "passport-strategy": "^1.0.0",
"pg": "^8.7.3", "pg": "^8.8.0",
"picsur-shared": "*", "picsur-shared": "*",
"posix.js": "^0.1.1", "posix.js": "^0.1.1",
"qoi-img": "^1.1.0", "qoi-img": "^1.1.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"rxjs": "^7.5.5", "rxjs": "^7.5.6",
"sharp": "^0.30.7", "sharp": "^0.30.7",
"typeorm": "0.3.6", "typeorm": "0.3.7",
"zod": "^3.17.3" "zod": "^3.18.0"
}, },
"devDependencies": { "devDependencies": {
"@nestjs/cli": "^8.2.8", "@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^8.0.11", "@nestjs/schematics": "^9.0.1",
"@nestjs/testing": "^8.4.7", "@nestjs/testing": "^9.0.11",
"@types/bcrypt": "^5.0.0", "@types/bcrypt": "^5.0.0",
"@types/cors": "^2.8.12", "@types/cors": "^2.8.12",
"@types/ms": "^0.7.31", "@types/ms": "^0.7.31",
"@types/multer": "^1.4.7", "@types/multer": "^1.4.7",
"@types/node": "^18.0.0", "@types/node": "^18.7.13",
"@types/passport-jwt": "^3.0.6", "@types/passport-jwt": "^3.0.6",
"@types/passport-local": "^1.0.34", "@types/passport-local": "^1.0.34",
"@types/passport-strategy": "^0.2.35", "@types/passport-strategy": "^0.2.35",
"@types/sharp": "^0.30.4", "@types/sharp": "^0.30.5",
"@types/supertest": "^2.0.12", "@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.29.0", "@typescript-eslint/eslint-plugin": "^5.35.1",
"@typescript-eslint/parser": "^5.29.0", "@typescript-eslint/parser": "^5.35.1",
"eslint": "^8.18.0", "eslint": "^8.22.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-loader": "^9.3.1", "ts-loader": "^9.3.1",
"ts-node": "^10.8.1", "ts-node": "^10.9.1",
"tsconfig-paths": "^4.0.0", "tsconfig-paths": "^4.1.0",
"typescript": "4.7.4", "typescript": "4.8.2",
"webpack": "^5.73.0" "webpack": "^5.74.0"
} }
} }

View File

@ -1,8 +1,8 @@
import { Repository } from 'typeorm'; import { ObjectLiteral, Repository } from 'typeorm';
// This is a function that returns an array of all available columns in a database table // This is a function that returns an array of all available columns in a database table
// It is used to fetch hidden columns from the database // It is used to fetch hidden columns from the database
export function GetCols<T>(repository: Repository<T>): (keyof T)[] { export function GetCols<T extends ObjectLiteral>(repository: Repository<T>): (keyof T)[] {
return repository.metadata.columns.map( return repository.metadata.columns.map(
(col) => col.propertyName, (col) => col.propertyName,
) as (keyof T)[]; ) as (keyof T)[];

View File

@ -35,6 +35,25 @@ export class ImageController {
private readonly userService: UsersService, private readonly userService: UsersService,
) {} ) {}
@Head(':id')
async headImage(
@Res({ passthrough: true }) res: FastifyReply,
@ImageFullIdParam() fullid: ImageFullId,
) {
if (fullid.type === 'original') {
const fullmime = await this.imagesService.getOriginalMime(fullid.id);
if (HasFailed(fullmime)) {
this.logger.warn(fullmime.getReason());
throw new NotFoundException('Could not find image');
}
res.type(fullmime.mime);
return;
}
res.type(fullid.mime);
}
@Get(':id') @Get(':id')
async getImage( async getImage(
// Usually passthrough is for manually sending the response, // Usually passthrough is for manually sending the response,
@ -68,25 +87,6 @@ export class ImageController {
return image.data; return image.data;
} }
@Head(':id')
async headImage(
@Res({ passthrough: true }) res: FastifyReply,
@ImageFullIdParam() fullid: ImageFullId,
) {
if (fullid.type === 'original') {
const fullmime = await this.imagesService.getOriginalMime(fullid.id);
if (HasFailed(fullmime)) {
this.logger.warn(fullmime.getReason());
throw new NotFoundException('Could not find image');
}
res.type(fullmime.mime);
return;
}
res.type(fullid.mime);
}
@Get('meta/:id') @Get('meta/:id')
@Returns(ImageMetaResponse) @Returns(ImageMetaResponse)
async getImageMeta(@ImageIdParam() id: string): Promise<ImageMetaResponse> { async getImageMeta(@ImageIdParam() id: string): Promise<ImageMetaResponse> {

View File

@ -148,7 +148,9 @@ export class SharpWrapper {
}, },
); );
const result = await pTimeout(finishPromise, this.instance_timeout); const result = await pTimeout(finishPromise, {
milliseconds: this.instance_timeout,
});
this.logger.verbose( this.logger.verbose(
`Worker ${this.workerID} finished in ${result.processingTime}ms`, `Worker ${this.workerID} finished in ${result.processingTime}ms`,
@ -174,7 +176,7 @@ export class SharpWrapper {
}); });
}); });
await pTimeout(waitReadyPromise, this.instance_timeout); await pTimeout(waitReadyPromise, { milliseconds: this.instance_timeout });
return true; return true;
} catch (error) { } catch (error) {
return Fail(FT.Internal, error); return Fail(FT.Internal, error);

View File

@ -33,10 +33,8 @@
"styles": ["src/styles.scss"], "styles": ["src/styles.scss"],
"scripts": [], "scripts": [],
"allowedCommonJsDependencies": [ "allowedCommonJsDependencies": [
"validator", "ngx-auto-unsubscribe-decorator",
"debug", "moment"
"buffer/",
"sha.js"
], ],
"optimization": true, "optimization": true,
"webWorkerTsConfig": "tsconfig.worker.json" "webWorkerTsConfig": "tsconfig.worker.json"

View File

@ -1,5 +1,4 @@
{ {
"private": false,
"name": "picsur-frontend", "name": "picsur-frontend",
"version": "0.3.0", "version": "0.3.0",
"description": "Frontend for Picsur", "description": "Frontend for Picsur",
@ -14,43 +13,43 @@
"purge": "rm -rf dist && rm -rf node_modules && rm -rf .angular" "purge": "rm -rf dist && rm -rf node_modules && rm -rf .angular"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "^14.0.3", "@angular/animations": "^14.2.0",
"@angular/cdk": "^14.0.3", "@angular/cdk": "^14.2.0",
"@angular/common": "^14.0.3", "@angular/common": "^14.2.0",
"@angular/compiler": "^14.0.3", "@angular/compiler": "^14.2.0",
"@angular/core": "^14.0.3", "@angular/core": "^14.2.0",
"@angular/forms": "^14.0.3", "@angular/forms": "^14.2.0",
"@angular/material": "^14.0.3", "@angular/material": "^14.2.0",
"@angular/platform-browser": "^14.0.3", "@angular/platform-browser": "^14.2.0",
"@angular/platform-browser-dynamic": "^14.0.3", "@angular/platform-browser-dynamic": "^14.2.0",
"@angular/router": "^14.0.3", "@angular/router": "^14.2.0",
"@ng-web-apis/common": "^2.0.0", "@ng-web-apis/common": "^2.0.1",
"@ng-web-apis/resize-observer": "^1.0.3", "@ng-web-apis/resize-observer": "^2.0.0",
"@ngui/common": "^1.0.0", "@ngui/common": "^1.0.0",
"bootstrap": "^5.1.3", "bootstrap": "^5.2.0",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"moment": "^2.29.3", "moment": "^2.29.4",
"ngx-auto-unsubscribe-decorator": "^1.1.0", "ngx-auto-unsubscribe-decorator": "^1.1.0",
"ngx-dropzone": "^3.1.0", "ngx-dropzone": "^3.1.0",
"ngx-moment": "^6.0.2", "ngx-moment": "^6.0.2",
"picsur-shared": "*", "picsur-shared": "*",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rxjs": "~7.5.5", "rxjs": "~7.5.6",
"tslib": "^2.4.0", "tslib": "^2.4.0",
"zod": "^3.17.3", "zod": "^3.18.0",
"zone.js": "~0.11.6" "zone.js": "~0.11.8"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "14.0.3", "@angular-devkit/build-angular": "14.2.0",
"@angular/cli": "^14.0.3", "@angular/cli": "^14.2.0",
"@angular/compiler-cli": "^14.0.3", "@angular/compiler-cli": "^14.2.0",
"@fontsource/material-icons": "^4.5.4", "@fontsource/material-icons": "^4.5.4",
"@fontsource/material-icons-outlined": "^4.5.4", "@fontsource/material-icons-outlined": "^4.5.4",
"@fontsource/roboto": "^4.5.7", "@fontsource/roboto": "^4.5.8",
"@types/node": "^18.0.0", "@types/node": "^18.7.13",
"@types/resize-observer-browser": "^0.1.7", "@types/resize-observer-browser": "^0.1.7",
"@types/validator": "^13.7.3", "@types/validator": "^13.7.5",
"typescript": "4.7.4" "typescript": "4.8.2"
} }
} }

View File

@ -7,27 +7,24 @@
"frontend" "frontend"
], ],
"scripts": { "scripts": {
"devdb:start": "podman-compose -f ./dev/docker-compose.yml up -d", "devdb:start": "docker-compose -f ./support/dev.docker-compose.yml up -d",
"devdb:stop": "podman-compose -f ./dev/docker-compose.yml down", "devdb:stop": "docker-compose -f ./support/dev.docker-compose.yml down",
"devdb:restart": "docker-compose -f ./support/dev.docker-compose.yml restart",
"devdb:remove": "docker-compose -f ./support/dev.docker-compose.yml down --rmi all --volumes",
"build": "./support/build.sh", "build": "./support/build.sh",
"setversion": "./support/setversion.sh", "setversion": "./support/setversion.sh",
"purge": "rm -rf ./node_modules", "purge": "rm -rf ./node_modules",
"purge-all": "./support/purge-all.sh" "purge-all": "./support/purge-all.sh"
}, },
"resolutions": { "resolutions": {
"fastify": "^4.1.0", "fastify": "^4.5.2",
"fastify-static": "npm:@fastify/static", "fastify-static": "npm:@fastify/static@*",
"fastify-formbody": "npm:@fastify/formbody", "fastify-formbody": "npm:@fastify/formbody@*",
"minimist": "npm:minimist-lite" "minimist": "npm:minimist-lite@*"
},
"dependencies": {
"fastify": "^4.1.0",
"fastify-formbody": "npm:@fastify/formbody",
"fastify-static": "npm:@fastify/static",
"minimist": "npm:minimist-lite"
}, },
"devDependencies": { "devDependencies": {
"prettier": "^2.7.1", "prettier": "^2.7.1",
"prettier-plugin-sh": "^0.12.3" "prettier-plugin-sh": "^0.12.8"
} },
"packageManager": "yarn@3.2.2"
} }

View File

@ -1,5 +1,4 @@
{ {
"private": false,
"name": "picsur-shared", "name": "picsur-shared",
"version": "0.3.0", "version": "0.3.0",
"description": "Shared libraries for Picsur", "description": "Shared libraries for Picsur",
@ -10,11 +9,11 @@
"main": "./dist/index.js", "main": "./dist/index.js",
"dependencies": { "dependencies": {
"tsc-watch": "^5.0.3", "tsc-watch": "^5.0.3",
"zod": "^3.17.3" "zod": "^3.18.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.0.0", "@types/node": "^18.7.13",
"typescript": "4.7.4" "typescript": "4.8.2"
}, },
"scripts": { "scripts": {
"clean": "rm -rf ./dist", "clean": "rm -rf ./dist",

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
PACKAGE_URL="ghcr.io/rubikscraft/picsur"
# Go to this script # Go to this script
cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(dirname "${BASH_SOURCE[0]}")"
@ -8,13 +10,13 @@ VERSION=$(cat ../package.json | grep version | head -1 | awk -F: '{ print $2 }'
echo "Building version $VERSION" echo "Building version $VERSION"
docker build -t "ghcr.io/rubikscraft/picsur:$VERSION" -t "ghcr.io/rubikscraft/picsur:latest" -f ./picsur.Dockerfile .. docker build -t "$PACKAGE_URL:$VERSION" -t "$PACKAGE_URL:latest" -f ./skala.Dockerfile ..
echo "Done" echo "Done"
echo "Pushing to ghcr.io" echo "Pushing to registry"
docker push "ghcr.io/rubikscraft/picsur:$VERSION" docker push "$PACKAGE_URL:$VERSION"
docker push "ghcr.io/rubikscraft/picsur:latest" docker push "$PACKAGE_URL:latest"
echo "Done" echo "Done"

View File

@ -1,4 +1,4 @@
FROM ghcr.io/rubikscraft/node-docker:1.0.0 FROM node:18.8
# Sorry for the humongous docker container this generates # Sorry for the humongous docker container this generates
# Maybe I'll trim it down some day # Maybe I'll trim it down some day

View File

@ -1,23 +1,8 @@
#!/bin/bash #!/bin/bash
yarn workspace shared purge
yarn workspace backend purge
yarn workspace frontend purge
yarn devdb:purge
yarn purge yarn purge
(
cd shared
yarn purge
)
(
cd backend
yarn purge
)
(
cd frontend
yarn purge
)
(
cd support
podman-compose -f ./dev.docker-compose.yml down
)

View File

@ -11,7 +11,7 @@ fi
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
UPDATE_VERSION="yarn version --no-commit-hooks --no-git-tag-version --new-version" UPDATE_VERSION="yarn version"
cd $SCRIPT_PATH/.. cd $SCRIPT_PATH/..
$UPDATE_VERSION $VERSION $UPDATE_VERSION $VERSION

20683
yarn.lock

File diff suppressed because it is too large Load Diff