Skip to content

Commit

Permalink
Add mjolnir support (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
amandahla authored Sep 19, 2023
1 parent 305370c commit 31b0b58
Show file tree
Hide file tree
Showing 40 changed files with 3,516 additions and 115 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,4 @@ cython_debug/
# Juju and Rock files
*.charm
*/*.rock
*/*.snap
1 change: 1 addition & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ header:
- 'trivy.yaml'
- 'zap_rules.tsv'
- 'lib/**'
- 'templates/**'
comment: on-failure
9 changes: 8 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ Build the charm in this git repository using:
charmcraft pack
```

<!-- You may want to include any contribution/style guidelines in this document>
## Generating src docs for every commit

Run the following command:

```bash
echo -e "tox -e src-docs\ngit add src-docs\n" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
```
10 changes: 8 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@ options:
type: string
description: |
The public-facing base URL that clients use to access this Homeserver.
It's used as entity_id if set instead of https://server_name. Only used if
there is integration with SAML integrator charm.
Defaults to https://<server_name>/. Only used if there is integration with
SAML integrator charm.
enable_mjolnir:
type: boolean
default: false
description: |
Configures whether to enable Mjolnir - moderation tool for Matrix.
Reference: https://github.com/matrix-org/mjolnir
6 changes: 6 additions & 0 deletions generate-src-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

lazydocs --no-watermark --output-path src-docs src/*
4 changes: 4 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ requires:
interface: saml
limit: 1
optional: true

peers:
synapse-peers:
interface: synapse-instance
37 changes: 37 additions & 0 deletions mjolnir_snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

name: mjolnir
summary: Mjolnir snap
description: A moderation tool for Matrix
version: "1.6.4"
base: core22
license: Apache-2.0
confinement: strict
apps:
mjolnir:
command: "bin/node $SNAP/mjolnir/index.js"
plugs:
- network
parts:
node:
plugin: dump
source: https://nodejs.org/dist/v16.20.2/node-v16.20.2-linux-x64.tar.xz
stage:
- bin
- include
- lib
install-mjolnir:
after: [node]
plugin: nil
source: https://github.com/matrix-org/mjolnir.git
source-tag: v1.6.4
source-type: git
override-build: |
npm install -g yarn
yarn install
yarn build
mv lib $CRAFT_PRIME/mjolnir
mv node_modules $CRAFT_PRIME/
mv mjolnir-entrypoint.sh $CRAFT_PRIME/
Loading

0 comments on commit 31b0b58

Please sign in to comment.