Skip to content

Commit 54af1a5

Browse files
committed
Initial commit after re-initialization.
Repo had to be re-initialized due to contamination with private sample files. Original git history can be found in the (private) adjacent repo suffixed `-archive`.
0 parents  commit 54af1a5

135 files changed

Lines changed: 9797 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
static/dist
2+
data
3+
branding

.github/workflows/deno.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# This workflow will install Deno then run `deno lint` and `deno test`.
7+
# For more information see: https://github.com/denoland/setup-deno
8+
9+
name: Deno
10+
11+
on:
12+
push:
13+
branches: ["main"]
14+
pull_request:
15+
branches: ["main"]
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
test:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Setup repo
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Deno
29+
# uses: denoland/setup-deno@v1
30+
uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2
31+
with:
32+
deno-version: v2.x
33+
34+
# Uncomment this step to verify the use of 'deno fmt' on each commit.
35+
# - name: Verify formatting
36+
# run: deno fmt --check
37+
38+
- name: Run linter
39+
run: deno lint
40+
41+
- name: Run Type Check
42+
run: deno check **/*.ts **/*.tsx
43+
44+
- name: Run tests
45+
run: deno test -A
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Docker
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
schedule:
10+
- cron: "17 13 * * *"
11+
push:
12+
branches: ["main"]
13+
# Publish semver tags as releases.
14+
tags: ["v*.*.*"]
15+
pull_request:
16+
branches: ["main"]
17+
18+
env:
19+
# Use docker.io for Docker Hub if empty
20+
REGISTRY: ghcr.io
21+
# github.repository as <account>/<repo>
22+
IMAGE_NAME: ${{ github.repository }}
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
30+
# This is used to complete the identity challenge
31+
# with sigstore/fulcio when running outside of PRs.
32+
id-token: write
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
# Install the cosign tool except on PR
39+
# https://github.com/sigstore/cosign-installer
40+
- name: Install cosign
41+
if: github.event_name != 'pull_request'
42+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
43+
with:
44+
cosign-release: "v2.2.4"
45+
46+
# Set up BuildKit Docker container builder to be able to build
47+
# multi-platform images and export cache
48+
# https://github.com/docker/setup-buildx-action
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
51+
52+
# Login against a Docker registry except on PR
53+
# https://github.com/docker/login-action
54+
- name: Log into registry ${{ env.REGISTRY }}
55+
if: github.event_name != 'pull_request'
56+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
57+
with:
58+
registry: ${{ env.REGISTRY }}
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
62+
# Extract metadata (tags, labels) for Docker
63+
# https://github.com/docker/metadata-action
64+
- name: Extract Docker metadata
65+
id: meta
66+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
67+
with:
68+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
69+
70+
# Build and push Docker image with Buildx (don't push on PR)
71+
# https://github.com/docker/build-push-action
72+
- name: Build and push Docker image
73+
id: build-and-push
74+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
75+
with:
76+
context: .
77+
push: ${{ github.event_name != 'pull_request' }}
78+
tags: ${{ steps.meta.outputs.tags }}
79+
labels: ${{ steps.meta.outputs.labels }}
80+
cache-from: type=gha
81+
cache-to: type=gha,mode=max
82+
platforms: linux/amd64,linux/arm64
83+
84+
# Sign the resulting Docker image digest except on PRs.
85+
# This will only write to the public Rekor transparency log when the Docker
86+
# repository is public to avoid leaking data. If you would like to publish
87+
# transparency data even for private images, pass --force to cosign below.
88+
# https://github.com/sigstore/cosign
89+
- name: Sign the published Docker image
90+
if: ${{ github.event_name != 'pull_request' }}
91+
env:
92+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
93+
TAGS: ${{ steps.meta.outputs.tags }}
94+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
95+
# This step uses the identity token to provision an ephemeral certificate
96+
# against the sigstore community Fulcio instance.
97+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.github/workflows/git-town.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Git Town
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "**"
7+
8+
jobs:
9+
git-town:
10+
name: Display the branch stack
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: git-town/action@v1

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/data
2+
/ingest
3+
*.pdf
4+
!sample.pdf
5+
!wbd-sample.pdf
6+
7+
# Static Assets
8+
static/dist
9+
10+
# Secrets
11+
.env
12+
13+
# OS Files
14+
.DS_Store
15+
Thumbs.db
16+
17+
# IDEs
18+
.idea
19+
.vscode
20+
!.vscode/settings.json
21+
!.vscode/tasks.json
22+
!.vscode/launch.json
23+
!.vscode/extensions.json

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: deno-install
5+
name: deno-install
6+
description: "Install Deno dependencies and check that the deno.lock file is up to date"
7+
language: system
8+
entry: deno install --frozen
9+
stages: [pre-commit]
10+
pass_filenames: false
11+
always_run: true
12+
require_serial: true
13+
- id: deno-fmt
14+
name: deno-fmt
15+
entry: deno fmt
16+
require_serial: true
17+
language: system
18+
pass_filenames: true
19+
description: "Format code using Deno's built-in formatter"
20+
stages: [pre-commit]
21+
- id: deno-lint
22+
name: deno-lint
23+
entry: deno lint
24+
language: system
25+
# pass_filenames: false
26+
files: \.(ts|tsx|js|jsx)$
27+
description: "Lint code using Deno's built-in linter"
28+
stages: [pre-commit]
29+
- id: deno-check
30+
name: deno-check
31+
entry: deno check
32+
language: system
33+
files: \.(ts|tsx|js|jsx)$
34+
# pass_filenames: false
35+
description: "Type-check code using Deno's built-in type checker"
36+
stages: [pre-commit]
37+
- id: deno-check-i18n
38+
name: deno-check-i18n
39+
entry: deno task check:i18n
40+
language: system
41+
files: \.(ts|tsx|js|jsx)$
42+
pass_filenames: false
43+
always_run: true
44+
description: "Run tests using Deno's built-in test runner"
45+
stages: [pre-commit]

.zed/settings.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Folder-specific settings
2+
//
3+
// For a full list of overridable settings, and general information on folder-specific settings,
4+
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
5+
{
6+
"lsp": {
7+
"deno": {
8+
"settings": {
9+
"deno": {
10+
"enable": true
11+
}
12+
}
13+
}
14+
},
15+
"languages": {
16+
"JavaScript": {
17+
"language_servers": [
18+
"deno",
19+
"!typescript-language-server",
20+
"!vtsls",
21+
"!eslint"
22+
],
23+
"formatter": "language_server"
24+
},
25+
"TypeScript": {
26+
"language_servers": [
27+
"deno",
28+
"!typescript-language-server",
29+
"!vtsls",
30+
"!eslint"
31+
],
32+
"formatter": "language_server"
33+
},
34+
"TSX": {
35+
"language_servers": [
36+
"deno",
37+
"!typescript-language-server",
38+
"!vtsls",
39+
"!eslint"
40+
],
41+
"formatter": "language_server"
42+
}
43+
}
44+
}

Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FROM denoland/deno:debian
2+
3+
LABEL org.label-schema.name="dms"
4+
LABEL org.opencontainers.image.description="MongoDB Based DMS System working with the deno-asn-generator"
5+
LABEL org.opencontainers.image.source=https://github.com/wuespace/dms
6+
LABEL org.opencontainers.image.licenses=MIT
7+
LABEL maintainer="WüSpace e. V."
8+
9+
EXPOSE 41319
10+
11+
ARG PACKAGES="\
12+
# Fonts
13+
fonts-liberation \
14+
# PDF text extraction with pdftotext
15+
poppler-utils \
16+
# OCR with ocrmypdf
17+
ocrmypdf \
18+
tesseract-ocr-eng \
19+
tesseract-ocr-deu \
20+
# ImageMagick
21+
imagemagick \
22+
# ImageMagick with PDF support
23+
ghostscript \
24+
# zbarimg
25+
zbar-tools \
26+
"
27+
28+
RUN apt-get update && apt-get install --yes --quiet --no-install-recommends ${PACKAGES}
29+
30+
WORKDIR /app
31+
32+
# Install Dependencies
33+
COPY deno.json deno.json
34+
COPY deno.lock deno.lock
35+
36+
RUN deno install --frozen
37+
38+
# Prepare static files
39+
COPY theme.scss theme.scss
40+
COPY client client
41+
COPY scripts scripts
42+
43+
RUN deno task compile:theme
44+
RUN deno task compile:client
45+
46+
47+
COPY . .
48+
49+
RUN deno install --frozen --entrypoint main.ts
50+
51+
ENTRYPOINT [ "/tini", "--", "docker-entrypoint.sh", "./main.ts" ]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 WüSpace e. V.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NOTES.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Development Notes
2+
3+
Stuff that should probably get documented at some point.
4+
5+
## Permission Model
6+
7+
### Write Permissions(_user_, _file_)
8+
9+
Write permissions allow users to update the data of a file.
10+
11+
1. Let _asn_ be the file's ASN
12+
2. Let _asn write roles_ be the `write` roles configured in the configuration
13+
corresponding to the _asn_'s folder.
14+
3. Let _user roles_ be the _user_'s roles
15+
4. If the _asn write roles_ include one or more roles from the _user roles_
16+
1. Return `true`
17+
5. If the _file_'s additional `write` roles include one or more roles from the
18+
_user roles_
19+
1. Return `true`
20+
6. Return `false`
21+
22+
### Read Permissions(_user_, _file_)
23+
24+
Read permissions allow users to see files without updating them.
25+
26+
1. Let _asn_ be the file's ASN
27+
2. Let _asn read roles_ be the `read` roles configured in the configuration
28+
corresponding to the _asn_'s folder.
29+
3. Let _user roles_ be the _user_'s roles
30+
4. If _user_ has write permissions for _file_
31+
1. Return `true`
32+
5. If the _file_'s `tags` include one or more of the `publicTags` configured in
33+
the configuration
34+
1. Return `true`
35+
6. If the _asn read roles_ include one or more roles from the _user roles_
36+
1. Return `true`
37+
7. If the _file_'s additional `read` roles include one or more roles from the
38+
_user roles_
39+
1. Return `true`
40+
8. Return `false`

0 commit comments

Comments
 (0)