Source code for the Codeberg e.V. registration web service. https://join.codeberg.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Gusted 4685eec9b7 Refactor + Tidy up code (#48) 4 weeks ago
etc move en translation 1 month ago
locales updating CZ translation 1 month ago
templates Merge 're-add post target' (#34) from jklippel into hackathon 1 month ago
.gitignore Update go modules 1 month ago
.woodpecker.yml Refactor + Tidy up code (#48) 4 weeks ago
LICENSE.md initial commit 3 years ago
Makefile Gofumpt the code (#46) 1 month ago
README.md add information about poswap into Readme 1 month ago
go.mod Update go modules 1 month ago
go.sum Update go modules 1 month ago
main.go Refactor + Tidy up code (#48) 4 weeks ago
main_test.go Refactor + Tidy up code (#48) 4 weeks ago

README.md

Introduction

This is the registration server used for the join.codeberg.org form.

Security

Incoming user data from forms is immediately encrypted using GnuPG Public-Key Encryption. No private key is ever stored on the server.

Encrypted registration records are sent via email to the registration accounts, from where they are fetched and processed off-line.

Files, Overview

README.md                                ## This file
main.go                                  ## Source code of the reg-server 
etc/                                     ## The config file template folder, copied to target host at deployment
etc/systemd/system/reg-server.service    ## Systemd service to launch, monitor and restart the reg-service
etc/reg-server/public-key.asc.gpg        ## The public GnuPG key used for encryption on the server
templates/                               ## content templates
locales/                                 ## Translation related files. Translations welcome.

Build+test locally

make
cd ./etc/reg-server
/tmp/build/gitea/bin/reg-server

Then point your browser at http://localhost:5000/

Build+deploy

You may want to start ssh-agent and do ssh-add before calling make deployment, to avoid typing your ssh passphrase several times. Then do:

make -C HOSTNAME_FQDN=<hostname> deployment

Translations

This tool uses gettext-compatible translation files. See the go-gettext-module documentation for further details.

Basically, it expects language files in locales/{de,en,...}/messages.mo.

As the .po files use for msgids message-stubs rather then the untranslated strings, you can use the English version as a base for your translation (so your poeditor can help as it should), thanks to the poswap utility. When you are done translating, you can swap the .po file back. If you already have a partially localized file, make sure to use it during the swapping. To install poswap locally, install translate-toolkit, for example like this: sudo apt install translate-toolkit. See more details about poswap here or this StackOverflow discussion.

To use (for example) the English version as a base for your translation (example given for Czech language translation):

poswap locales/en/messages.po -t locales/cs/messages.po -o locales/cs/messages.po 

After you are done translating, poswap it back:

poswap --reverse locales/en/messages.po -t locales/cs/messages.po -o locales/cs/messages.po

The .mo files can be generated from the .po files using msgfmt:

find locales -name "*.po" -execdir msgfmt "{}" ";"

Environment variables

The mail setup uses the following environment variables:

export MAIL_REGISTRATION_RECIPIENT=codeberg-test@codeberg.org
export MAIL_FROM=codeberg-test@codeberg.org
export MAIL_PASSWORD="THE-MAIL-PASSWORD"
export MAIL_HOST=mail.codeberg.local
export MAIL_PORT=587

/tmp/build/reg-server/bin/reg-server

To test the functionality you can set the environment variables to match your environment.

You must add your public key (matching MAIL_FROM) to etc/reg-server/public-key.asc.gpg if you want to be able to receive the encrypted mails.

License

This software (excluding bundled fonts) is licensed under GNU AGPL. See the LICENSE file for details.

Logo material is by @mray and licensed under CC-BY. http://creativecommons.org/licenses/by/4.0/

Codeberg and the Codeberg Logo are trademarks of Codeberg e.V.