65 Commits

Author SHA1 Message Date
ce3053c0ba Merge pull request 'Release 0.4.2' (#39) from dev into main
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build was killed
Reviewed-on: #39
Reviewed-by: Philipp Dormann <philipp@philippdormann.de>
2021-03-29 16:46:31 +00:00
6608456c68 🧾New changelog file version [CI SKIP] [skip ci] 2021-03-29 16:44:43 +00:00
1cbe5a1614 🚀Bumped version to v0.4.2
Some checks failed
continuous-integration/drone/push Build is failing
2021-03-29 18:43:29 +02:00
9584bfed8b Fixed faulty object mapping 2021-03-29 18:42:50 +02:00
0839ff6359 🧾New changelog file version [CI SKIP] [skip ci] 2021-03-20 17:13:45 +00:00
4739193709 Merge branch 'dev' of git.odit.services:lfk/document-server into dev
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-20 18:12:54 +01:00
0ade57536e 🧾New changelog file version [CI SKIP] [skip ci] 2021-03-20 17:13:17 +00:00
d17108f4b9 🚀Bumped version to v0.4.1 2021-03-20 18:12:50 +01:00
3c42ca3042 Emergency bugfixes 🐞
Some checks failed
continuous-integration/drone/push Build is failing
2021-03-20 18:12:34 +01:00
073433f308 🧾New changelog file version [CI SKIP] [skip ci] 2021-03-15 14:31:35 +00:00
8bac1fadd6 🧾New changelog file version [CI SKIP] [skip ci] 2021-03-14 20:20:59 +00:00
a478081727 🧾New changelog file version [CI SKIP] [skip ci] 2021-03-14 20:14:03 +00:00
b1978e796f Merge branch 'dev' of git.odit.services:lfk/document-server into dev
All checks were successful
continuous-integration/drone/push Build is passing
2021-03-14 21:13:19 +01:00
c51ec74d30 Let's try the mtu fix
´
2021-03-14 21:13:14 +01:00
b8f0d1fa60 🧾New changelog file version [CI SKIP] [skip ci] 2021-03-14 20:05:37 +00:00
96886c74bc Now using our own images to build stuff 🚀
Some checks failed
continuous-integration/drone/push Build was killed
2021-03-14 21:04:51 +01:00
8d3cc34395 Merge pull request 'Alpha Release 0.4.0' (#38) from dev into main
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is failing
Reviewed-on: #38
Reviewed-by: Philipp Dormann <philipp@philippdormann.de>
2021-03-14 15:51:53 +00:00
85519bc2e4 🚀Bumped version to v0.4.0
Some checks failed
continuous-integration/drone/push Build is failing
2021-03-14 16:33:17 +01:00
ed02306738 Merge pull request 'Configureable contracts amount feature/35-contracts_per_runner' (#37) from feature/35-contracts_per_runner into dev
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #37
2021-03-14 15:31:26 +00:00
31a59500fa Documented the new config var
ref #35
2021-03-13 14:03:14 +01:00
d01b4a0b99 Added config for amount of contracts per runner
ref #35
2021-03-13 14:01:30 +01:00
d9919404b5 Added logic for generateing multiple contracts per runner
ref #35
2021-03-13 13:59:34 +01:00
b180e04045 Updated ci with new kubernetes secrets 🚀🚀🚀
Some checks failed
continuous-integration/drone/push Build is failing
ref odit/org#12
2021-03-12 18:58:09 +01:00
7f28525ec2 Merge branch 'feature/33-disclaimer' into dev
Some checks failed
continuous-integration/drone/push Build is failing
2021-03-10 20:15:39 +01:00
677bd86133 Changed ci pipeline type to kubernetes
ref odit/org#12 (comment)
2021-03-10 20:11:16 +01:00
b612562d34 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-20 15:19:11 +00:00
e9d3574599 Merge pull request 'Configurable sponsoring disclaimer feature/33-disclaimer' (#34) from feature/33-disclaimer into dev
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #34
2021-02-20 15:18:55 +00:00
9dd62cefa9 Added reamde entry for the new env var
ref #33
2021-02-20 16:05:58 +01:00
0797c678c8 Merge branch 'feature/33-disclaimer' of git.odit.services:lfk/document-server into feature/33-disclaimer 2021-02-20 16:04:02 +01:00
5e4d6f44da MAde disclaimer configurable via env
ref #33
2021-02-20 16:04:00 +01:00
885765ac71 MAde disclaimer configurable via env 2021-02-20 16:03:54 +01:00
03ed6d5bc1 Updated styleing
ref #33
2021-02-20 16:03:15 +01:00
4e1e124d0d Added disclaimer to template
ref #33
2021-02-20 15:58:11 +01:00
19fbf50f6f 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-19 19:10:02 +00:00
21b5e048ed Merge pull request 'Alpha Release 0.3.3 - Download options' (#32) from dev into main
All checks were successful
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is passing
Reviewed-on: #32
Reviewed-by: Philipp Dormann <philipp@philippdormann.de>
2021-02-19 19:09:25 +00:00
c012b4943d 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-19 19:08:18 +00:00
7c23dba493 Merge branch 'dev' of git.odit.services:lfk/document-server into dev
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-19 20:07:59 +01:00
ba566bcc33 🚀Bumped version to v0.3.3 2021-02-19 20:04:44 +01:00
a386c5bef8 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-19 19:04:35 +00:00
1ca5d3ea07 Added download option to cards
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-19 20:04:15 +01:00
fd8b7e56da 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-19 18:35:54 +00:00
55877de2aa Added download header
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-19 19:35:06 +01:00
d1a29c1cbb 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-18 15:22:54 +00:00
e6f7dd2be8 Merge pull request 'Alpha Release 0.3.2' (#31) from dev into main
All checks were successful
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is passing
Reviewed-on: #31
Reviewed-by: Philipp Dormann <philipp@philippdormann.de>
2021-02-18 15:22:26 +00:00
49590b897e 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-18 15:18:27 +00:00
a9019e4c67 🚀Bumped version to v0.3.2
All checks were successful
continuous-integration/drone/push Build is passing
2021-02-18 16:18:01 +01:00
cc6a53b258 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-18 15:17:10 +00:00
e0db6f6a78 Merge pull request 'Now using full group names feature/18-group_names' (#30) from feature/18-group_names into dev
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #30
2021-02-18 15:16:53 +00:00
0fcfb30d5c Updated templates with full group name
ref #18
2021-02-17 18:59:14 +01:00
c2909082a2 Now manually parsing runnergroup full names
ref #18
2021-02-17 18:57:21 +01:00
92c52401b3 📖New license file version [CI SKIP] [skip ci] 2021-02-16 17:49:26 +00:00
7ca7266ea4 Pinned routing controllers version as temp workaround for routing controllers openapi being broken again
All checks were successful
continuous-integration/drone/push Build is passing
Initial failure: https://ci.odit.services/lfk/document-server/47/1/2
2021-02-16 18:47:52 +01:00
adf11ab1c3 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-13 20:13:40 +00:00
db91661556 Merge pull request 'Alpha Release 0.3.1 - API Keys' (#29) from dev into main
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #29
Reviewed-by: Philipp Dormann <philipp@philippdormann.de>
2021-02-13 20:13:14 +00:00
9d7d044384 📖New license file version [CI SKIP] [skip ci] 2021-02-13 20:11:44 +00:00
95099c5fbd 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-13 20:10:54 +00:00
782861bd93 Merge branch 'dev' of git.odit.services:lfk/document-server into dev
Some checks failed
continuous-integration/drone/push Build is failing
2021-02-13 21:10:34 +01:00
dcde424b77 🚀Bumped version to v0.3.1 2021-02-13 21:10:26 +01:00
b7c6c6e157 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-13 20:09:52 +00:00
2d031dae03 Merge pull request 'API Key based auth feature/26-api_auth' (#27) from feature/26-api_auth into dev
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #27
2021-02-13 20:09:36 +00:00
729f2d7240 Added auth to openapi spec
ref #26
2021-02-13 16:24:47 +01:00
454309278e Added api key to env doc
ref #26
2021-02-13 16:16:36 +01:00
7be211f8b7 Fixed bug
ref #26
2021-02-13 16:14:08 +01:00
bdeadd274b Implemented basic auth
ref #26
2021-02-13 16:09:58 +01:00
e306cdb2c8 🧾New changelog file version [CI SKIP] [skip ci] 2021-02-12 17:04:08 +00:00
17 changed files with 416 additions and 190 deletions

View File

@@ -1,6 +1,27 @@
---
kind: secret
name: docker_username
get:
path: odit-registry-builder
name: username
---
kind: secret
name: docker_password
get:
path: odit-registry-builder
name: password
---
kind: secret
name: git_ssh
get:
path: odit-git-bot
name: sshkey
--- ---
kind: pipeline kind: pipeline
type: docker type: kubernetes
name: build:dev name: build:dev
clone: clone:
disable: true disable: true
@@ -16,13 +37,14 @@ steps:
depends_on: [clone] depends_on: [clone]
settings: settings:
username: username:
from_secret: DOCKER_REGISTRY_USER from_secret: docker_username
password: password:
from_secret: DOCKER_REGISTRY_PASSWORD from_secret: docker_password
repo: registry.odit.services/lfk/document-server repo: registry.odit.services/lfk/document-server
tags: tags:
- dev - dev
registry: registry.odit.services registry: registry.odit.services
mtu: 1000
- name: run changelog export - name: run changelog export
depends_on: ["clone"] depends_on: ["clone"]
image: node:latest image: node:latest
@@ -38,7 +60,7 @@ steps:
author_email: bot@odit.services author_email: bot@odit.services
remote: git@git.odit.services:lfk/document-server.git remote: git@git.odit.services:lfk/document-server.git
ssh_key: ssh_key:
from_secret: GITLAB_SSHKEY from_secret: git_ssh
- name: run full license export - name: run full license export
depends_on: ["clone"] depends_on: ["clone"]
image: node:14.15.1-alpine3.12 image: node:14.15.1-alpine3.12
@@ -56,7 +78,7 @@ steps:
remote: git@git.odit.services:lfk/document-server.git remote: git@git.odit.services:lfk/document-server.git
skip_verify: true skip_verify: true
ssh_key: ssh_key:
from_secret: GITLAB_SSHKEY from_secret: git_ssh
trigger: trigger:
branch: branch:
@@ -66,7 +88,7 @@ trigger:
--- ---
kind: pipeline kind: pipeline
type: docker type: kubernetes
name: build:latest name: build:latest
clone: clone:
disable: true disable: true
@@ -84,9 +106,9 @@ steps:
image: plugins/docker image: plugins/docker
settings: settings:
username: username:
from_secret: DOCKER_REGISTRY_USER from_secret: docker_username
password: password:
from_secret: DOCKER_REGISTRY_PASSWORD from_secret: docker_password
repo: registry.odit.services/lfk/document-server repo: registry.odit.services/lfk/document-server
tags: tags:
- latest - latest
@@ -99,7 +121,7 @@ steps:
commit: false commit: false
remote: git@git.odit.services:lfk/document-server.git remote: git@git.odit.services:lfk/document-server.git
ssh_key: ssh_key:
from_secret: GITLAB_SSHKEY from_secret: git_ssh
trigger: trigger:
branch: branch:
@@ -109,7 +131,7 @@ trigger:
--- ---
kind: pipeline kind: pipeline
type: docker type: kubernetes
name: build:tags name: build:tags
steps: steps:
@@ -118,9 +140,9 @@ steps:
depends_on: [clone] depends_on: [clone]
settings: settings:
username: username:
from_secret: DOCKER_REGISTRY_USER from_secret: docker_username
password: password:
from_secret: DOCKER_REGISTRY_PASSWORD from_secret: docker_password
repo: registry.odit.services/lfk/document-server repo: registry.odit.services/lfk/document-server
tags: tags:
- '${DRONE_TAG}' - '${DRONE_TAG}'

View File

@@ -2,16 +2,93 @@
All notable changes to this project will be documented in this file. Dates are displayed in UTC. All notable changes to this project will be documented in this file. Dates are displayed in UTC.
#### [v0.4.2](https://git.odit.services/lfk/document-server/compare/v0.4.0...v0.4.2)
- 🚀Bumped version to v0.4.1 [`d17108f`](https://git.odit.services/lfk/document-server/commit/d17108f4b9f041727afcee5c171d5d8f9a3c677c)
- 🧾New changelog file version [CI SKIP] [skip ci] [`0ade575`](https://git.odit.services/lfk/document-server/commit/0ade57536e372a62356fe2f329f6cfe04bcfc397)
- Fixed faulty object mapping [`9584bfe`](https://git.odit.services/lfk/document-server/commit/9584bfed8ba5b8c856b55aa90969874d4d6751ff)
- 🧾New changelog file version [CI SKIP] [skip ci] [`8bac1fa`](https://git.odit.services/lfk/document-server/commit/8bac1fadd6b4257e5062a1b1673e122c5b535046)
- 🧾New changelog file version [CI SKIP] [skip ci] [`b8f0d1f`](https://git.odit.services/lfk/document-server/commit/b8f0d1fa60da4e3262623cecf4a78c8a9a322f8c)
- 🧾New changelog file version [CI SKIP] [skip ci] [`073433f`](https://git.odit.services/lfk/document-server/commit/073433f308f2f8e7ada97dd0b3896fb541e85711)
- 🧾New changelog file version [CI SKIP] [skip ci] [`a478081`](https://git.odit.services/lfk/document-server/commit/a47808172797e12800c46d17ccf4b458f4a506de)
- 🧾New changelog file version [CI SKIP] [skip ci] [`0839ff6`](https://git.odit.services/lfk/document-server/commit/0839ff63593cfb9e8339b2b2a86dbe7e2afb5dcb)
- Now using our own images to build stuff 🚀 [`96886c7`](https://git.odit.services/lfk/document-server/commit/96886c74bc397e1ee793e83e0d01a6bbaa953da3)
- 🚀Bumped version to v0.4.2 [`1cbe5a1`](https://git.odit.services/lfk/document-server/commit/1cbe5a1614c40fbf23f032be60039ddb1472ca94)
- Emergency bugfixes 🐞 [`3c42ca3`](https://git.odit.services/lfk/document-server/commit/3c42ca30427174c21e0db6426d8f0d91a1ebc501)
- Let's try the mtu fix [`c51ec74`](https://git.odit.services/lfk/document-server/commit/c51ec74d30334b156668de4719c77f2e9c6d023f)
#### [v0.4.0](https://git.odit.services/lfk/document-server/compare/v0.3.3...v0.4.0)
> 14 March 2021
- Merge pull request 'Alpha Release 0.4.0' (#38) from dev into main [`8d3cc34`](https://git.odit.services/lfk/document-server/commit/8d3cc34395922a271da1032310da6ec6f7a164f7)
- Updated ci with new kubernetes secrets 🚀🚀🚀 [`b180e04`](https://git.odit.services/lfk/document-server/commit/b180e0404537404d0564453fde5976f4de672a8b)
- Updated styleing [`03ed6d5`](https://git.odit.services/lfk/document-server/commit/03ed6d5bc18c5b26edd7b1d698c9de936e008f32)
- 🧾New changelog file version [CI SKIP] [skip ci] [`b612562`](https://git.odit.services/lfk/document-server/commit/b612562d347f5fafcf4ce94a4508b7c0bb9370c6)
- 🚀Bumped version to v0.4.0 [`85519bc`](https://git.odit.services/lfk/document-server/commit/85519bc2e4e8906732dc5f99e417014a14bad7d0)
- Merge pull request 'Configureable contracts amount feature/35-contracts_per_runner' (#37) from feature/35-contracts_per_runner into dev [`ed02306`](https://git.odit.services/lfk/document-server/commit/ed023067386551dc92d60ba63dff8bc4cc44ce00)
- Added disclaimer to template [`4e1e124`](https://git.odit.services/lfk/document-server/commit/4e1e124d0dc08f96aeb05dd1c975064fe785b80f)
- Changed ci pipeline type to kubernetes [`677bd86`](https://git.odit.services/lfk/document-server/commit/677bd861335302269baec96a59916475bbdd405f)
- Added config for amount of contracts per runner [`d01b4a0`](https://git.odit.services/lfk/document-server/commit/d01b4a0b99f3c1aa088b02d766d21bfb6b9e3a29)
- Added logic for generateing multiple contracts per runner [`d991940`](https://git.odit.services/lfk/document-server/commit/d9919404b5b90151318d20258a273ca6c7640393)
- MAde disclaimer configurable via env [`5e4d6f4`](https://git.odit.services/lfk/document-server/commit/5e4d6f44dab581483135594432bd8c8d65ba74ef)
- MAde disclaimer configurable via env [`885765a`](https://git.odit.services/lfk/document-server/commit/885765ac71b6a65c869ee841c383667f4947dcde)
- Documented the new config var [`31a5950`](https://git.odit.services/lfk/document-server/commit/31a59500fa77f1ad7c54fa297d00c8707ae6db9c)
- Merge pull request 'Configurable sponsoring disclaimer feature/33-disclaimer' (#34) from feature/33-disclaimer into dev [`e9d3574`](https://git.odit.services/lfk/document-server/commit/e9d35745997a9e948509ea67b59f5a7658f9d652)
- 🧾New changelog file version [CI SKIP] [skip ci] [`19fbf50`](https://git.odit.services/lfk/document-server/commit/19fbf50f6f6057c5321a999b6551d05db32b5fd8)
- Added reamde entry for the new env var [`9dd62ce`](https://git.odit.services/lfk/document-server/commit/9dd62cefa94bf3f0bf8e77fd25e7ca1ec4b30e2b)
#### [v0.3.3](https://git.odit.services/lfk/document-server/compare/v0.3.2...v0.3.3)
> 19 February 2021
- Merge pull request 'Alpha Release 0.3.3 - Download options' (#32) from dev into main [`21b5e04`](https://git.odit.services/lfk/document-server/commit/21b5e048ed5ed72f88304e5c737639c54cc71483)
- 🧾New changelog file version [CI SKIP] [skip ci] [`d1a29c1`](https://git.odit.services/lfk/document-server/commit/d1a29c1cbb8845a1adf8a414d158ebcabd48dc04)
- 🧾New changelog file version [CI SKIP] [skip ci] [`fd8b7e5`](https://git.odit.services/lfk/document-server/commit/fd8b7e56da4a1601141f63627e3990660c521ea6)
- Added download option to cards [`1ca5d3e`](https://git.odit.services/lfk/document-server/commit/1ca5d3ea078ef51818657e2b3c9f114c67bff86d)
- Added download header [`55877de`](https://git.odit.services/lfk/document-server/commit/55877de2aa46583f30d033467037e0454d1236be)
- 🧾New changelog file version [CI SKIP] [skip ci] [`c012b49`](https://git.odit.services/lfk/document-server/commit/c012b4943d96ee3a9442c65389c4dcea08642109)
- 🚀Bumped version to v0.3.3 [`ba566bc`](https://git.odit.services/lfk/document-server/commit/ba566bcc33ed920324cd9977b3f293a2c629f92c)
- 🧾New changelog file version [CI SKIP] [skip ci] [`a386c5b`](https://git.odit.services/lfk/document-server/commit/a386c5bef88da29e4447399d4edca0234b674ed5)
#### [v0.3.2](https://git.odit.services/lfk/document-server/compare/v0.3.0...v0.3.2)
> 18 February 2021
- Merge pull request 'Alpha Release 0.3.2' (#31) from dev into main [`e6f7dd2`](https://git.odit.services/lfk/document-server/commit/e6f7dd2be8d729f5fc7fbb458cc859b113f5aa86)
- 🚀Bumped version to v0.3.1 [`dcde424`](https://git.odit.services/lfk/document-server/commit/dcde424b77dcc9753859f94f7bcbe24fe3523c27)
- 📖New license file version [CI SKIP] [skip ci] [`92c5240`](https://git.odit.services/lfk/document-server/commit/92c52401b398f6a2f247c10879e17f6dc105aa8e)
- Now manually parsing runnergroup full names [`c290908`](https://git.odit.services/lfk/document-server/commit/c2909082a2dbb38041ae0fc695bd0fa1451b39ff)
- Implemented basic auth [`bdeadd2`](https://git.odit.services/lfk/document-server/commit/bdeadd274bc0f9c8cbab35a8a5605bef4c22ba6c)
- 📖New license file version [CI SKIP] [skip ci] [`9d7d044`](https://git.odit.services/lfk/document-server/commit/9d7d0443848522e5bdfdb6a80c836bea4bc200a1)
- 🧾New changelog file version [CI SKIP] [skip ci] [`cc6a53b`](https://git.odit.services/lfk/document-server/commit/cc6a53b25895594874acca370a1439d37bb280de)
- 🧾New changelog file version [CI SKIP] [skip ci] [`e306cdb`](https://git.odit.services/lfk/document-server/commit/e306cdb2c8e58fc1aef79b95cba5d4cc96ac7658)
- Added auth to openapi spec [`729f2d7`](https://git.odit.services/lfk/document-server/commit/729f2d7240b54ffe2d4db36cce29de0afdfc9417)
- Pinned routing controllers version as temp workaround for routing controllers openapi being broken again [`7ca7266`](https://git.odit.services/lfk/document-server/commit/7ca7266ea46965251c9df637a2556f2a1706e7e6)
- 🧾New changelog file version [CI SKIP] [skip ci] [`b7c6c6e`](https://git.odit.services/lfk/document-server/commit/b7c6c6e15708e471f5c3d0ca4cf11b1c08c88c9c)
- 🧾New changelog file version [CI SKIP] [skip ci] [`95099c5`](https://git.odit.services/lfk/document-server/commit/95099c5fbd7e6cb07c68151a998eebb0f00556f3)
- 🧾New changelog file version [CI SKIP] [skip ci] [`49590b8`](https://git.odit.services/lfk/document-server/commit/49590b897ed5ee5c9386d34408ac6868f43cc27c)
- 🚀Bumped version to v0.3.2 [`a9019e4`](https://git.odit.services/lfk/document-server/commit/a9019e4c67e7620b65650d60b0ebd57bc11a854e)
- Merge pull request 'Now using full group names feature/18-group_names' (#30) from feature/18-group_names into dev [`e0db6f6`](https://git.odit.services/lfk/document-server/commit/e0db6f6a78d0026a8485a57c88af1e9407bd68a4)
- 🧾New changelog file version [CI SKIP] [skip ci] [`adf11ab`](https://git.odit.services/lfk/document-server/commit/adf11ab1c356b6964230541331836abd363170b0)
- Updated templates with full group name [`0fcfb30`](https://git.odit.services/lfk/document-server/commit/0fcfb30d5c13266ca4faf7697308dfb7a0f91b4f)
- Merge pull request 'Alpha Release 0.3.1 - API Keys' (#29) from dev into main [`db91661`](https://git.odit.services/lfk/document-server/commit/db916615564813e8d21e3672581e4f3a4d748b89)
- Merge pull request 'API Key based auth feature/26-api_auth' (#27) from feature/26-api_auth into dev [`2d031da`](https://git.odit.services/lfk/document-server/commit/2d031dae035866a4aa247398ea68ff338ab58cbd)
- Added api key to env doc [`4543092`](https://git.odit.services/lfk/document-server/commit/454309278ef20a2b97248277b07a7b58a063618d)
- Fixed bug [`7be211f`](https://git.odit.services/lfk/document-server/commit/7be211f8b7b26f7f620df81af4ebde5eec2feec2)
#### [v0.3.0](https://git.odit.services/lfk/document-server/compare/v0.2.0...v0.3.0) #### [v0.3.0](https://git.odit.services/lfk/document-server/compare/v0.2.0...v0.3.0)
- 🚀Bumped version to v0.3.0 [`449a96b`](https://git.odit.services/lfk/document-server/commit/449a96b3027fe93d8042b30420245f66e92f14b8) > 12 February 2021
- Merge pull request 'Card generation feature/14-card_generation' (#24) from feature/14-card_generation into dev [`703eaa0`](https://git.odit.services/lfk/document-server/commit/703eaa0e9d667b628eab4e8496689fe66238f896)
- Merge pull request 'Alpha Release 0.3.0 - Runnercard generation' (#25) from dev into main [`406add3`](https://git.odit.services/lfk/document-server/commit/406add3d517473d01628b6405569de6cb85114e0)
- 🚀Bumped version to v0.2.0 [`491cdb8`](https://git.odit.services/lfk/document-server/commit/491cdb8d71a80ea196d16334c0c80b8f7cc859c5) - 🚀Bumped version to v0.2.0 [`491cdb8`](https://git.odit.services/lfk/document-server/commit/491cdb8d71a80ea196d16334c0c80b8f7cc859c5)
- Added card generation speed tests (part 1) [`68572b1`](https://git.odit.services/lfk/document-server/commit/68572b194eb740238be8101efed6fdb2a207f65b) - Added card generation speed tests (part 1) [`68572b1`](https://git.odit.services/lfk/document-server/commit/68572b194eb740238be8101efed6fdb2a207f65b)
- Implemented first experimental speedtest [`e3a45a6`](https://git.odit.services/lfk/document-server/commit/e3a45a61ac3b2d691c2f75d36155896b7ed301d8) - Implemented first experimental speedtest [`e3a45a6`](https://git.odit.services/lfk/document-server/commit/e3a45a61ac3b2d691c2f75d36155896b7ed301d8)
- Added basic logic to generate two-sided runnercards [`d3a213c`](https://git.odit.services/lfk/document-server/commit/d3a213ce3326aeb96d924e16a31fc87bf82eb5b3) - Added basic logic to generate two-sided runnercards [`d3a213c`](https://git.odit.services/lfk/document-server/commit/d3a213ce3326aeb96d924e16a31fc87bf82eb5b3)
- 🧾New changelog file version [CI SKIP] [skip ci] [`149bf18`](https://git.odit.services/lfk/document-server/commit/149bf1849db20b863ec998a72c77559ec401bc32) - 🧾New changelog file version [CI SKIP] [skip ci] [`149bf18`](https://git.odit.services/lfk/document-server/commit/149bf1849db20b863ec998a72c77559ec401bc32)
- Fixed double-sided printing [`7f58dd6`](https://git.odit.services/lfk/document-server/commit/7f58dd694b53152069c2095b2e18dd3a46cd04dd) - Fixed double-sided printing [`7f58dd6`](https://git.odit.services/lfk/document-server/commit/7f58dd694b53152069c2095b2e18dd3a46cd04dd)
- 🧾New changelog file version [CI SKIP] [skip ci] [`e74b9a4`](https://git.odit.services/lfk/document-server/commit/e74b9a4c9d041780e0cfd8c4d68a5b63f916e091)
- Added basic card generation function [`8fc6c71`](https://git.odit.services/lfk/document-server/commit/8fc6c7176ee92f813db1e1d4b3e5ef1b2f4e1aef) - Added basic card generation function [`8fc6c71`](https://git.odit.services/lfk/document-server/commit/8fc6c7176ee92f813db1e1d4b3e5ef1b2f4e1aef)
- Beautified output a bit [`aefe549`](https://git.odit.services/lfk/document-server/commit/aefe5493b06c04cc2b20029e1f7fc5f15ec9c04e) - Beautified output a bit [`aefe549`](https://git.odit.services/lfk/document-server/commit/aefe5493b06c04cc2b20029e1f7fc5f15ec9c04e)
- Added barcode generatin [`5c075bc`](https://git.odit.services/lfk/document-server/commit/5c075bce8b94ff4482448c3cd56bdc28cbe0a7d9) - Added barcode generatin [`5c075bc`](https://git.odit.services/lfk/document-server/commit/5c075bce8b94ff4482448c3cd56bdc28cbe0a7d9)
@@ -25,6 +102,8 @@ All notable changes to this project will be documented in this file. Dates are d
- Fixed runnercard backside padding [`08e8587`](https://git.odit.services/lfk/document-server/commit/08e858726c1462b599ba9cb3f7fb057f35178b83) - Fixed runnercard backside padding [`08e8587`](https://git.odit.services/lfk/document-server/commit/08e858726c1462b599ba9cb3f7fb057f35178b83)
- Added sizing for the real cards [`b92a6f7`](https://git.odit.services/lfk/document-server/commit/b92a6f7b2b98fb0074d5a563d9918295e9ec0274) - Added sizing for the real cards [`b92a6f7`](https://git.odit.services/lfk/document-server/commit/b92a6f7b2b98fb0074d5a563d9918295e9ec0274)
- 🧾New changelog file version [CI SKIP] [skip ci] [`8a90f63`](https://git.odit.services/lfk/document-server/commit/8a90f63b0919376beefef6a52aae9a59337aea59) - 🧾New changelog file version [CI SKIP] [skip ci] [`8a90f63`](https://git.odit.services/lfk/document-server/commit/8a90f63b0919376beefef6a52aae9a59337aea59)
- 🚀Bumped version to v0.3.0 [`449a96b`](https://git.odit.services/lfk/document-server/commit/449a96b3027fe93d8042b30420245f66e92f14b8)
- Merge pull request 'Card generation feature/14-card_generation' (#24) from feature/14-card_generation into dev [`703eaa0`](https://git.odit.services/lfk/document-server/commit/703eaa0e9d667b628eab4e8496689fe66238f896)
- Added speedtest script to package [`75b8b28`](https://git.odit.services/lfk/document-server/commit/75b8b281b87d9b173093f16beae12d707ec05052) - Added speedtest script to package [`75b8b28`](https://git.odit.services/lfk/document-server/commit/75b8b281b87d9b173093f16beae12d707ec05052)
- Fixed bug in array swapping function [`9697d53`](https://git.odit.services/lfk/document-server/commit/9697d53a1527854536f8ddf5426f7ca902772f51) - Fixed bug in array swapping function [`9697d53`](https://git.odit.services/lfk/document-server/commit/9697d53a1527854536f8ddf5426f7ca902772f51)
- Added **very** basic backside [`68f46a4`](https://git.odit.services/lfk/document-server/commit/68f46a45b5a51c8a8edafca852cb274af388fa76) - Added **very** basic backside [`68f46a4`](https://git.odit.services/lfk/document-server/commit/68f46a45b5a51c8a8edafca852cb274af388fa76)

View File

@@ -1,5 +1,5 @@
# Typescript Build # Typescript Build
FROM registry.odit.services/mirror/node:14.15.1-alpine3.12 FROM registry.odit.services/hub/library/node:14.15.1-alpine3.12
WORKDIR /app WORKDIR /app
COPY package.json ./ COPY package.json ./
RUN npm i -g pnpm RUN npm i -g pnpm
@@ -8,7 +8,7 @@ COPY tsconfig.json ./
COPY src ./src COPY src ./src
RUN pnpm run build RUN pnpm run build
# final image # final image
FROM registry.odit.services/mirror/alpine:3.13.1 FROM registry.odit.services/hub/library/alpine:3.13.1
WORKDIR /app WORKDIR /app
RUN apk add --no-cache \ RUN apk add --no-cache \
chromium \ chromium \

View File

@@ -35,6 +35,9 @@ The basic generation mechanism makes the templates and routes interchangeable (i
| CURRENCY_SYMBOL | String | "€" | The your currency's symbol - used to generate pdf text. | CURRENCY_SYMBOL | String | "€" | The your currency's symbol - used to generate pdf text.
| SPONSORING_RECEIPT_MINIMUM_AMOUNT | String | "10" | The mimimum total donation amount a sponsor has to donate to be able to receive a donation receipt - used to generate pdf text. | SPONSORING_RECEIPT_MINIMUM_AMOUNT | String | "10" | The mimimum total donation amount a sponsor has to donate to be able to receive a donation receipt - used to generate pdf text.
| SPONOR_LOGOS | Array<String> | Empty png | The sponsor images you want to loop through. You can provide them via http url, local file or base64-encoded image. | SPONOR_LOGOS | Array<String> | Empty png | The sponsor images you want to loop through. You can provide them via http url, local file or base64-encoded image.
| API_KEY | String(min length: 64) | Random generated string | The api key you want to use for auth (query-param `key`), has to be at least 64 chars long.
| DISCLAIMER_TEXT | String | N/A | A disclaimer that will get displayed on the bottom of each sponsoring contract. R/N You can only provide the disclaimer for one language.
| CONTRACTS_PER_RUNNER | Number | 1 | The amount of contracts that get created per runner (per request).
## Templates ## Templates
> The document server uses html templates to generate various pdf documents. > The document server uses html templates to generate various pdf documents.

View File

@@ -1,9 +1,15 @@
version: "3" version: "3"
services: services:
document_server: document_server:
build: . build: .
ports: ports:
- 4010:4010 - 4010:4010
environment: environment:
APP_PORT: 4010 APP_PORT: 4010
NODE_ENV: production NODE_ENV: production
EVENT_NAME: "Lauf für Kaya! 2021"
CURRENCY_SYMBOL: "€"
API_KEY: RYRccAJ4SKZnZaEci6Nyk9Z6mw3sD94fyKJ74WNzi6hLkxGNyJDrKPkxBmPwvR4f
CONTRACTS_PER_RUNNER: 2
SPONSORING_RECEIPT_MINIMUM_AMOUNT: 50
DISCLAIMER_TEXT: "Rechtsgrundlage unserer Datenverarbeitung aufgrund freiwilliger Einwilligung ist Art. 6 Abs. 1 e), Abs. 3 DSGVO i.V.m. Art. 85 BayEUG. Mit Ihrer Unterschrift willigen Sie in unsere Datennutzung zum Zwecke des Lauf für Kaya! ein. Die Daten für Spendenquittungen"

View File

@@ -58,7 +58,7 @@ THE SOFTWARE.
# axios # axios
**Author**: Matt Zabriskie **Author**: Matt Zabriskie
**Repo**: [object Object] **Repo**: https://github.com/axios/axios.git
**License**: MIT **License**: MIT
**Description**: Promise based HTTP client for the browser and node.js **Description**: Promise based HTTP client for the browser and node.js
## License Text ## License Text
@@ -85,7 +85,7 @@ THE SOFTWARE.
# bwip-js # bwip-js
**Author**: Mark Warren <mwarren@metafloor.com> **Author**: Mark Warren <mwarren@metafloor.com>
**Repo**: [object Object] **Repo**: https://github.com/metafloor/bwip-js.git
**License**: MIT **License**: MIT
**Description**: JavaScript barcode generator supporting over 100 types and standards. **Description**: JavaScript barcode generator supporting over 100 types and standards.
## License Text ## License Text
@@ -117,7 +117,7 @@ THE SOFTWARE.
# cheerio # cheerio
**Author**: Matt Mueller <mattmuelle@gmail.com> (mat.io) **Author**: Matt Mueller <mattmuelle@gmail.com> (mat.io)
**Repo**: [object Object] **Repo**: git://github.com/cheeriojs/cheerio.git
**License**: MIT **License**: MIT
**Description**: Tiny, fast, and elegant implementation of core jQuery designed specifically for the server **Description**: Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
## License Text ## License Text
@@ -145,7 +145,7 @@ SOFTWARE.
# class-transformer # class-transformer
**Author**: [object Object] **Author**: [object Object]
**Repo**: [object Object] **Repo**: https://github.com/typestack/class-transformer.git
**License**: MIT **License**: MIT
**Description**: Proper decorator-based transformation / serialization / deserialization of plain javascript objects to class constructors **Description**: Proper decorator-based transformation / serialization / deserialization of plain javascript objects to class constructors
## License Text ## License Text
@@ -173,7 +173,7 @@ THE SOFTWARE.
# class-validator # class-validator
**Author**: TypeStack contributors **Author**: TypeStack contributors
**Repo**: [object Object] **Repo**: https://github.com/typestack/class-validator.git
**License**: MIT **License**: MIT
**Description**: Decorator-based property validation for classes. **Description**: Decorator-based property validation for classes.
## License Text ## License Text
@@ -240,7 +240,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# dotenv # dotenv
**Author**: undefined **Author**: undefined
**Repo**: [object Object] **Repo**: git://github.com/motdotla/dotenv.git
**License**: BSD-2-Clause **License**: BSD-2-Clause
**Description**: Loads environment variables from .env file **Description**: Loads environment variables from .env file
## License Text ## License Text
@@ -303,7 +303,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# handlebars # handlebars
**Author**: Yehuda Katz **Author**: Yehuda Katz
**Repo**: [object Object] **Repo**: https://github.com/wycats/handlebars.js.git
**License**: MIT **License**: MIT
**Description**: Handlebars provides the power necessary to let you build semantic templates effectively with no frustration **Description**: Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
## License Text ## License Text
@@ -330,7 +330,7 @@ THE SOFTWARE.
# i18next # i18next
**Author**: Jan Mühlemann <jan.muehlemann@gmail.com> (https://github.com/jamuhl) **Author**: Jan Mühlemann <jan.muehlemann@gmail.com> (https://github.com/jamuhl)
**Repo**: [object Object] **Repo**: https://github.com/i18next/i18next.git
**License**: MIT **License**: MIT
**Description**: i18next internationalization framework **Description**: i18next internationalization framework
## License Text ## License Text
@@ -359,7 +359,7 @@ SOFTWARE.
# i18next-fs-backend # i18next-fs-backend
**Author**: undefined **Author**: undefined
**Repo**: [object Object] **Repo**: git@github.com:i18next/i18next-fs-backend.git
**License**: undefined **License**: undefined
**Description**: i18next-fs-backend is a backend layer for i18next using in Node.js and for Deno to load translations from the filesystem. **Description**: i18next-fs-backend is a backend layer for i18next using in Node.js and for Deno to load translations from the filesystem.
## License Text ## License Text
@@ -637,7 +637,7 @@ SOFTWARE.
# reflect-metadata # reflect-metadata
**Author**: [object Object] **Author**: [object Object]
**Repo**: [object Object] **Repo**: https://github.com/rbuckton/reflect-metadata.git
**License**: Apache-2.0 **License**: Apache-2.0
**Description**: Polyfill for Metadata Reflection API **Description**: Polyfill for Metadata Reflection API
## License Text ## License Text
@@ -699,7 +699,7 @@ END OF TERMS AND CONDITIONS
# routing-controllers # routing-controllers
**Author**: [object Object] **Author**: [object Object]
**Repo**: [object Object] **Repo**: https://github.com/typestack/routing-controllers.git
**License**: MIT **License**: MIT
**Description**: Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript. **Description**: Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.
## License Text ## License Text
@@ -736,7 +736,7 @@ SOFTWARE.
# @odit/license-exporter # @odit/license-exporter
**Author**: ODIT.Services **Author**: ODIT.Services
**Repo**: [object Object] **Repo**: https://git.odit.services/odit/license-exporter
**License**: MIT **License**: MIT
**Description**: A simple license crawler for crediting open source work **Description**: A simple license crawler for crediting open source work
## License Text ## License Text
@@ -763,7 +763,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @types/express # @types/express
**Author**: undefined **Author**: undefined
**Repo**: [object Object] **Repo**: https://github.com/DefinitelyTyped/DefinitelyTyped.git
**License**: MIT **License**: MIT
**Description**: TypeScript definitions for Express **Description**: TypeScript definitions for Express
## License Text ## License Text
@@ -792,7 +792,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @types/node # @types/node
**Author**: undefined **Author**: undefined
**Repo**: [object Object] **Repo**: https://github.com/DefinitelyTyped/DefinitelyTyped.git
**License**: MIT **License**: MIT
**Description**: TypeScript definitions for Node.js **Description**: TypeScript definitions for Node.js
## License Text ## License Text
@@ -821,7 +821,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @types/puppeteer # @types/puppeteer
**Author**: undefined **Author**: undefined
**Repo**: [object Object] **Repo**: https://github.com/DefinitelyTyped/DefinitelyTyped.git
**License**: MIT **License**: MIT
**Description**: TypeScript definitions for puppeteer **Description**: TypeScript definitions for puppeteer
## License Text ## License Text
@@ -850,7 +850,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# cp-cli # cp-cli
**Author**: undefined **Author**: undefined
**Repo**: [object Object] **Repo**: git+https://github.com/screendriver/cp-cli.git
**License**: MIT **License**: MIT
**Description**: A 'cp' CLI util for Node.js **Description**: A 'cp' CLI util for Node.js
## License Text ## License Text
@@ -879,7 +879,7 @@ SOFTWARE.
# faker # faker
**Author**: undefined **Author**: undefined
**Repo**: [object Object] **Repo**: http://github.com/Marak/Faker.js.git
**License**: MIT **License**: MIT
**Description**: Generate massive amounts of fake contextual data **Description**: Generate massive amounts of fake contextual data
## License Text ## License Text
@@ -887,7 +887,7 @@ SOFTWARE.
# nodemon # nodemon
**Author**: [object Object] **Author**: [object Object]
**Repo**: [object Object] **Repo**: https://github.com/remy/nodemon.git
**License**: MIT **License**: MIT
**Description**: Simple monitor script for use during development of a node.js app. **Description**: Simple monitor script for use during development of a node.js app.
## License Text ## License Text
@@ -916,7 +916,7 @@ SOFTWARE.
# release-it # release-it
**Author**: [object Object] **Author**: [object Object]
**Repo**: [object Object] **Repo**: https://github.com/release-it/release-it.git
**License**: MIT **License**: MIT
**Description**: Generic CLI tool to automate versioning and package publishing related tasks. **Description**: Generic CLI tool to automate versioning and package publishing related tasks.
## License Text ## License Text
@@ -968,7 +968,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# start-server-and-test # start-server-and-test
**Author**: Gleb Bahmutov <gleb.bahmutov@gmail.com> **Author**: Gleb Bahmutov <gleb.bahmutov@gmail.com>
**Repo**: [object Object] **Repo**: https://github.com/bahmutov/start-server-and-test.git
**License**: MIT **License**: MIT
**Description**: Starts server, waits for URL, then runs test command; when the tests end, shuts down server **Description**: Starts server, waits for URL, then runs test command; when the tests end, shuts down server
## License Text ## License Text
@@ -976,7 +976,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# ts-node # ts-node
**Author**: [object Object] **Author**: [object Object]
**Repo**: [object Object] **Repo**: git://github.com/TypeStrong/ts-node.git
**License**: MIT **License**: MIT
**Description**: TypeScript execution environment and REPL for node.js, with source map support **Description**: TypeScript execution environment and REPL for node.js, with source map support
## License Text ## License Text
@@ -1005,7 +1005,7 @@ THE SOFTWARE.
# typescript # typescript
**Author**: Microsoft Corp. **Author**: Microsoft Corp.
**Repo**: [object Object] **Repo**: https://github.com/Microsoft/TypeScript.git
**License**: Apache-2.0 **License**: Apache-2.0
**Description**: TypeScript is a language for application scale JavaScript development **Description**: TypeScript is a language for application scale JavaScript development
## License Text ## License Text

View File

@@ -1,6 +1,6 @@
{ {
"name": "@odit/lfk-document-server", "name": "@odit/lfk-document-server",
"version": "0.3.0", "version": "0.4.2",
"description": "The document generation server for the LfK! runner system. This generates certificates, sponsoring aggreements and more", "description": "The document generation server for the LfK! runner system. This generates certificates, sponsoring aggreements and more",
"main": "src/app.ts", "main": "src/app.ts",
"scripts": { "scripts": {
@@ -59,11 +59,11 @@
"pdf-lib": "^1.16.0", "pdf-lib": "^1.16.0",
"puppeteer": "^7.0.1", "puppeteer": "^7.0.1",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"routing-controllers": "^0.9.0-alpha.6", "routing-controllers": "0.9.0-alpha.6",
"routing-controllers-openapi": "^2.2.0" "routing-controllers-openapi": "2.2.0"
}, },
"devDependencies": { "devDependencies": {
"@odit/license-exporter": "^0.0.9", "@odit/license-exporter": "^0.0.10",
"@types/express": "^4.17.11", "@types/express": "^4.17.11",
"@types/node": "^14.14.22", "@types/node": "^14.14.22",
"@types/puppeteer": "^5.4.3", "@types/puppeteer": "^5.4.3",

View File

@@ -22,6 +22,7 @@ export class PdfCreator {
private templateDir = path.join(__dirname, '/templates'); private templateDir = path.join(__dirname, '/templates');
private browser; private browser;
private static interpolations = { eventname: config.eventname, sponsoring_receipt_minimum_amount: config.sponsoring_receipt_minimum_amount, currency_symbol: config.currency_symbol } private static interpolations = { eventname: config.eventname, sponsoring_receipt_minimum_amount: config.sponsoring_receipt_minimum_amount, currency_symbol: config.currency_symbol }
private static contractsPerRunner = config.contracts_per_runner;
/** /**
* Main constructor. * Main constructor.
@@ -108,6 +109,11 @@ export class PdfCreator {
if (runners.length == 1 && Object.keys(runners[0]).length == 0) { if (runners.length == 1 && Object.keys(runners[0]).length == 0) {
runners[0] = this.generateEmptyRunner(); runners[0] = this.generateEmptyRunner();
} }
for (var i = 1; i < PdfCreator.contractsPerRunner; i++) {
runners = runners.reduce(function (res, current, index, array) {
return res.concat([current, current]);
}, []);
}
if (runners.length > 50) { if (runners.length > 50) {
let pdf_promises = new Array<Promise<Buffer>>(); let pdf_promises = new Array<Promise<Buffer>>();
let i, j; let i, j;
@@ -121,7 +127,7 @@ export class PdfCreator {
await i18next.changeLanguage(locale); await i18next.changeLanguage(locale);
const template_source = fs.readFileSync(`${this.templateDir}/sponsoring_contract.html`, 'utf8'); const template_source = fs.readFileSync(`${this.templateDir}/sponsoring_contract.html`, 'utf8');
const template = Handlebars.compile(template_source); const template = Handlebars.compile(template_source);
let result = template({ runners, codeformat }); let result = template({ runners, codeformat, disclaimer: config.disclaimer_text });
result = await awaitAsyncHandlebarHelpers(result); result = await awaitAsyncHandlebarHelpers(result);
const pdf = await this.renderPdf(result, { format: "A5", landscape: true }); const pdf = await this.renderPdf(result, { format: "A5", landscape: true });
return pdf return pdf

View File

@@ -1,25 +1,33 @@
import { MetadataArgsStorage } from 'routing-controllers'; import { MetadataArgsStorage } from 'routing-controllers';
import { routingControllersToSpec } from 'routing-controllers-openapi'; import { routingControllersToSpec } from 'routing-controllers-openapi';
import { config } from './config'; import { config } from './config';
/** /**
* This function generates a the openapi spec from route metadata and type schemas. * This function generates a the openapi spec from route metadata and type schemas.
* @param storage MetadataArgsStorage object generated by routing-controllers. * @param storage MetadataArgsStorage object generated by routing-controllers.
* @param schemas MetadataArgsStorage object generated by class-validator-jsonschema. * @param schemas MetadataArgsStorage object generated by class-validator-jsonschema.
*/ */
export function generateSpec(storage: MetadataArgsStorage, schemas) { export function generateSpec(storage: MetadataArgsStorage, schemas) {
return routingControllersToSpec( return routingControllersToSpec(
storage, storage,
{}, {},
{ {
components: { components: {
schemas, schemas,
}, "securitySchemes": {
info: { "AuthToken": {
description: "The the API for the LfK! document server.", "type": "apiKey",
title: "LfK! document server API", "in": "query",
version: config.version "name": "key",
}, description: "A simple api key. See the README's env section for more details."
} }
); }
},
info: {
description: "The the API for the LfK! document server.",
title: "LfK! document server API",
version: config.version
},
}
);
} }

View File

@@ -1,29 +1,31 @@
import consola from "consola"; import consola from "consola";
import "reflect-metadata"; import "reflect-metadata";
import { createExpressServer } from "routing-controllers"; import { createExpressServer } from "routing-controllers";
import { config, e as errors } from './config'; import { config, e as errors } from './config';
import loaders from "./loaders/index"; import loaders from "./loaders/index";
import { ErrorHandler } from './middlewares/ErrorHandler'; import AuthChecker from './middlewares/AuthChecker';
import { ErrorHandler } from './middlewares/ErrorHandler';
const CONTROLLERS_FILE_EXTENSION = process.env.NODE_ENV === 'production' ? 'js' : 'ts';
const app = createExpressServer({ const CONTROLLERS_FILE_EXTENSION = process.env.NODE_ENV === 'production' ? 'js' : 'ts';
middlewares: [ErrorHandler], const app = createExpressServer({
development: config.development, middlewares: [ErrorHandler],
cors: true, authorizationChecker: AuthChecker,
controllers: [`${__dirname}/controllers/*.${CONTROLLERS_FILE_EXTENSION}`], development: config.development,
}); cors: true,
controllers: [`${__dirname}/controllers/*.${CONTROLLERS_FILE_EXTENSION}`],
async function main() { });
await loaders(app);
app.listen(config.internal_port, () => { async function main() {
consola.success( await loaders(app);
`⚡️[server]: Server is running at http://localhost:${config.internal_port}` app.listen(config.internal_port, () => {
); consola.success(
}); `⚡️[server]: Server is running at http://localhost:${config.internal_port}`
} );
if (errors === 0) { });
main(); }
} else { if (errors === 0) {
consola.error("error"); main();
// something's wrong } else {
} consola.error("error");
// something's wrong
}

View File

@@ -1,30 +1,57 @@
import { config as configDotenv } from 'dotenv'; import consola from "consola";
import { config as configDotenv } from 'dotenv';
configDotenv();
export const config = { configDotenv();
internal_port: parseInt(process.env.APP_PORT) || 4010, export const config = {
development: process.env.NODE_ENV === "production", internal_port: parseInt(process.env.APP_PORT) || 4010,
version: process.env.VERSION || require('../package.json').version, development: process.env.NODE_ENV === "production",
eventname: process.env.EVENT_NAME || "Please set the event name", version: process.env.VERSION || require('../package.json').version,
currency_symbol: process.env.CURRENCY_SYMBOL || "€", eventname: process.env.EVENT_NAME || "Please set the event name",
sponsoring_receipt_minimum_amount: process.env.SPONSORING_RECEIPT_MINIMUM_AMOUNT || "10", currency_symbol: process.env.CURRENCY_SYMBOL || "",
codeformat: process.env.CODEFORMAT || "qrcode", sponsoring_receipt_minimum_amount: process.env.SPONSORING_RECEIPT_MINIMUM_AMOUNT || "10",
sponor_logos: getSponsorLogos() codeformat: process.env.CODEFORMAT || "qrcode",
} sponor_logos: getSponsorLogos(),
let errors = 0 api_key: getApiKey(),
if (typeof config.internal_port !== "number") { disclaimer_text: process.env.DISCLAIMER_TEXT || "",
errors++ contracts_per_runner: parseInt(process.env.CONTRACTS_PER_RUNNER) || 1,
} }
if (typeof config.development !== "boolean") { let errors = 0
errors++ if (typeof config.internal_port !== "number") {
} errors++
function getSponsorLogos(): string[] { }
try { if (typeof config.contracts_per_runner !== "number") {
const logos = JSON.parse(process.env.SPONOR_LOGOS); errors++
if (!Array.isArray(logos)) { throw new Error("Not an array.") } }
return logos; if (typeof config.development !== "boolean") {
} catch (error) { errors++
return ["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg=="]; }
} function getSponsorLogos(): string[] {
} try {
const logos = JSON.parse(process.env.SPONOR_LOGOS);
if (!Array.isArray(logos)) { throw new Error("Not an array.") }
return logos;
} catch (error) {
return ["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg=="];
}
}
function getApiKey(): string {
const key = process.env.API_KEY;
if (!key) {
consola.info("No API key set - generating a random one...");
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
for (var i = 0; i < 64; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
consola.info(`API KEY: ${result}`)
return result;
}
if (key.length < 64) {
consola.error(`API key is too short - minimum: 64, current: ${key.length}`)
throw new Error("API_KEY too short.")
}
return key
}
export let e = errors export let e = errors

View File

@@ -1,46 +1,97 @@
import { Body, JsonController, Post, QueryParam, Res } from 'routing-controllers'; import { Authorized, Body, JsonController, Post, QueryParam, Res } from 'routing-controllers';
import { OpenAPI } from 'routing-controllers-openapi'; import { OpenAPI } from 'routing-controllers-openapi';
import { Runner } from '../models/Runner'; import { Runner } from '../models/Runner';
import { RunnerCard } from '../models/RunnerCard'; import { RunnerCard } from '../models/RunnerCard';
import { PdfCreator } from '../PdfCreator'; import { PdfCreator } from '../PdfCreator';
/** /**
* The pdf controller handels all endpoints concerning pdf generation. * The pdf controller handels all endpoints concerning pdf generation.
* It therefore is the hearth of the document-generation server's endpoints. * It therefore is the hearth of the document-generation server's endpoints.
* All endpoints have to accept a locale query-param to support i18n. * All endpoints have to accept a locale query-param to support i18n.
*/ */
@JsonController() @JsonController()
export class PdfController { @Authorized()
private pdf: PdfCreator = new PdfCreator(); @OpenAPI({ security: [{ "AuthToken": [] }] })
private initialized: boolean = false; export class PdfController {
private pdf: PdfCreator = new PdfCreator();
@Post('/contracts') private initialized: boolean = false;
@OpenAPI({ description: "Generate Sponsoring contract pdfs from runner objects.<br>You can choose your prefered locale by passing the 'locale' query-param.<br> If you provide more than 100 runenrs this could take a moment or two (we tested up to 1000 runners in about 70sec so far)." })
async generateContracts(@Body({ validate: true, options: { limit: "500mb" } }) runners: Runner | Runner[], @Res() res: any, @QueryParam("locale") locale: string, @QueryParam("codeformat") codeformat: string) { @Post('/contracts')
if (!this.initialized) { @OpenAPI({ description: "Generate Sponsoring contract pdfs from runner objects.<br>You can choose your prefered locale by passing the 'locale' query-param.<br> If you provide more than 100 runenrs this could take a moment or two (we tested up to 1000 runners in about 70sec so far)." })
await this.pdf.init(); async generateContracts(@Body({ validate: true, options: { limit: "500mb" } }) runners: Runner[], @Res() res: any, @QueryParam("locale") locale: string, @QueryParam("codeformat") codeformat: string, @QueryParam("download") download: boolean) {
this.initialized = true; if (!this.initialized) {
} await this.pdf.init();
if (!Array.isArray(runners)) { this.initialized = true;
runners = [runners]; }
} if (!Array.isArray(runners)) {
const contracts = await this.pdf.generateSponsoringContract(runners, locale, codeformat); runners = [runners];
res.setHeader('content-type', 'application/pdf'); }
return contracts; runners = this.mapRunnerGroupNames(runners)
} const contracts = await this.pdf.generateSponsoringContract(runners, locale, codeformat);
res.setHeader('content-type', 'application/pdf');
@Post('/cards') if (download) {
@OpenAPI({ description: "Generate runner card pdfs from runner card objects.<br>You can choose your prefered locale by passing the 'locale' query-param." }) res.setHeader('Content-Disposition', 'attachment; filename="contracts.pdf"')
async generateCards(@Body({ validate: true, options: { limit: "500mb" } }) cards: RunnerCard | RunnerCard[], @Res() res: any, @QueryParam("locale") locale: string) { }
if (!this.initialized) { return contracts;
await this.pdf.init(); }
this.initialized = true;
} @Post('/cards')
if (!Array.isArray(cards)) { @OpenAPI({ description: "Generate runner card pdfs from runner card objects.<br>You can choose your prefered locale by passing the 'locale' query-param." })
cards = [cards]; async generateCards(@Body({ validate: true, options: { limit: "500mb" } }) cards: RunnerCard | RunnerCard[], @Res() res: any, @QueryParam("locale") locale: string, @QueryParam("download") download: boolean) {
} if (!this.initialized) {
const contracts = await this.pdf.generateRunnerCards(cards, locale); await this.pdf.init();
res.setHeader('content-type', 'application/pdf'); this.initialized = true;
return contracts; }
} if (!Array.isArray(cards)) {
} cards = [cards];
}
cards = this.mapCardGroupNames(cards);
const contracts = await this.pdf.generateRunnerCards(cards, locale);
res.setHeader('content-type', 'application/pdf');
if (download) {
res.setHeader('Content-Disposition', 'attachment; filename="cards.pdf"')
}
return contracts;
}
private mapRunnerGroupNames(runners: Runner[]): Runner[] {
let response = new Array<Runner>();
for (let runner of runners) {
if (!runner.group.parentGroup) {
runner.group.fullName = runner.group.name;
}
else {
runner.group.fullName = `${runner.group.parentGroup.name}/${runner.group.name}`;
}
response.push(runner)
}
return response;
}
private mapCardGroupNames(cards: RunnerCard[]): RunnerCard[] {
let response = new Array<RunnerCard>();
for (let card of cards) {
if (!card.runner) {
card.runner = {
id: 0,
firstname: "Blank",
lastname: "Blank",
distance: 0,
group: {
id: 0,
name: "Blank",
fullName: "Blank"
}
}
}
else if (!card.runner.group.parentGroup) {
card.runner.group.fullName = card.runner.group.name;
}
else {
card.runner.group.fullName = `${card.runner.group.parentGroup.name}/${card.runner.group.name}`;
}
response.push(card)
}
return response;
}
}

View File

@@ -0,0 +1,14 @@
import { Action } from "routing-controllers";
import { config } from '../config';
/**
* Handles authentication via jwt's (Bearer authorization header) for all api endpoints using the @Authorized decorator.
* @param action Routing-Controllers action object that provides request and response objects among other stuff.
* @param permissions The permissions that the endpoint using @Authorized requires.
*/
const AuthChecker = async (action: Action) => {
const provided_token = action.request.query.key;
return provided_token == config.api_key;
}
export default AuthChecker

View File

@@ -13,7 +13,8 @@ import {
IsPositive, IsPositive,
IsString IsString,
ValidateNested
} from "class-validator"; } from "class-validator";
import { RunnerGroup } from './RunnerGroup'; import { RunnerGroup } from './RunnerGroup';
@@ -53,6 +54,7 @@ export class Runner {
* The runner's group. * The runner's group.
*/ */
@IsObject() @IsObject()
@ValidateNested()
group: RunnerGroup; group: RunnerGroup;
/** /**
@@ -60,4 +62,8 @@ export class Runner {
*/ */
@IsInt() @IsInt()
distance: number; distance: number;
constructor() {
console.log("called")
}
} }

View File

@@ -25,4 +25,6 @@ export class RunnerGroup {
@IsObject() @IsObject()
@IsOptional() @IsOptional()
parentGroup?: RunnerGroup; parentGroup?: RunnerGroup;
fullName: string;
} }

View File

@@ -48,7 +48,7 @@
</div> </div>
</div> </div>
<p>{{this.runner.lastname}}, {{this.runner.firstname}} {{this.runner.middlename}}</p> <p>{{this.runner.lastname}}, {{this.runner.firstname}} {{this.runner.middlename}}</p>
<p>{{this.runner.group.name}}</p> <p>{{this.runner.group.fullName}}</p>
</div> </div>
{{/each}} {{/each}}
</div> </div>

View File

@@ -64,12 +64,12 @@
<p style="font-size: x-small; display: block;">{{__ "lastname"}}</p> <p style="font-size: x-small; display: block;">{{__ "lastname"}}</p>
</div> </div>
<div class="column is-6"> <div class="column is-6">
<span style="border-bottom: 1px solid; width: 100%; display: block;">{{this.group.name}}</span> <span style="border-bottom: 1px solid; width: 100%; display: block;">{{this.group.fullName}}</span>
<p style="font-size: x-small; display: block;">{{__ "group"}}</p> <p style="font-size: x-small; display: block;">{{__ "group"}}</p>
</div> </div>
</div> </div>
<p>{{__ "sponsoring_amount_per_distance"}}</p> <p style="margin-top: -0.5rem">{{__ "sponsoring_amount_per_distance"}}</p>
<div class="columns"> <div class="columns" style="margin-top: -1rem;">
<div class="column is-6"> <div class="column is-6">
<span style="border-bottom: 1px solid; width: 100%; display: block;"></span> <span style="border-bottom: 1px solid; width: 100%; display: block;"></span>
<p style="font-size: x-small; display: block;">{{__ "lastname"}}</p> <p style="font-size: x-small; display: block;">{{__ "lastname"}}</p>
@@ -79,9 +79,9 @@
<p style="font-size: x-small; display: block;">{{__ "firstname"}}</p> <p style="font-size: x-small; display: block;">{{__ "firstname"}}</p>
</div> </div>
</div> </div>
<p style="font-size: medium;">{{__ "address"}} ({{__ "sponsor"}})</p> <p style="font-size: medium; margin-top: -0.5rem;">{{__ "address"}} ({{__ "sponsor"}})</p>
<p style="font-size: x-small;">({{__ "sponsoring_address_condition"}})</p> <p style="font-size: x-small;">({{__ "sponsoring_address_condition"}})</p>
<div class="columns"> <div class="columns" style="margin-top: -1rem;">
<div class="column is-8"> <div class="column is-8">
<span style="border-bottom: 1px solid; width: 100%; display: block;"></span> <span style="border-bottom: 1px solid; width: 100%; display: block;"></span>
<p style="font-size: x-small; display: block;">{{__ "street"}}</p> <p style="font-size: x-small; display: block;">{{__ "street"}}</p>
@@ -91,7 +91,7 @@
<p style="font-size: x-small; display: block;">{{__ "house_number"}}</p> <p style="font-size: x-small; display: block;">{{__ "house_number"}}</p>
</div> </div>
</div> </div>
<div class="columns"> <div class="columns" style="margin-top: -1rem;">
<div class="column is-4"> <div class="column is-4">
<span style="border-bottom: 1px solid; width: 100%; display: block;"></span> <span style="border-bottom: 1px solid; width: 100%; display: block;"></span>
<p style="font-size: x-small; display: block;">{{__ "postalcode"}}</p> <p style="font-size: x-small; display: block;">{{__ "postalcode"}}</p>
@@ -101,8 +101,7 @@
<p style="font-size: x-small; display: block;">{{__ "city"}}</p> <p style="font-size: x-small; display: block;">{{__ "city"}}</p>
</div> </div>
</div> </div>
<br> <div class="columns" style="margin-top: -1rem;">
<div class="columns">
<div class="column is-7"> <div class="column is-7">
<span style="border-bottom: 1px solid; width: 100%; display: block;"></span> <span style="border-bottom: 1px solid; width: 100%; display: block;"></span>
<p style="font-size: x-small; display: block;">{{__ "location"}}, {{__ "date"}}</p> <p style="font-size: x-small; display: block;">{{__ "location"}}, {{__ "date"}}</p>
@@ -112,6 +111,7 @@
<p style="font-size: x-small; display: block;">{{__ "signature"}}</p> <p style="font-size: x-small; display: block;">{{__ "signature"}}</p>
</div> </div>
</div> </div>
<p style="font-size: xx-small; overflow: hidden; height: 4rem; text-align: center;">{{../disclaimer}}</p>
</div> </div>
</div> </div>
{{/each}} {{/each}}