-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0793229
commit 63d39a2
Showing
16 changed files
with
1,682 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# ignore special macOS files | ||
.DS_Store | ||
|
||
# ignore directories | ||
binaries/ | ||
assets/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# discourse-user-api-key | ||
|
||
### Purpose | ||
With a User-API-Key it is possible to perform certain actions automatically in a (Discourse) forum. The User-API-Key is bound to a user. The actions are performed on behalf of the user for whom the User-API-Key was created. | ||
|
||
This utility allows to request a User-API-Key from a (Discourse) forum. The utility is available as command line interface application for different operating systems. | ||
|
||
### Binaries | ||
Precompiled binaries for many operating systems can be found here: **Releases -> Assets** | ||
|
||
### Usage | ||
``` text | ||
% ./discourse-user-api-key -h | ||
Program: | ||
Name : discourse-user-api-key | ||
Release : v1.0.0 - 2022/10/31 | ||
Purpose : obtain Discourse User-API-Key | ||
Info : This program obtains a User-API-Key for a Discourse forum. | ||
Usage: | ||
./discourse-user-api-key -forum=string [-application=string] [-client=string] [-scopes=list] [-nonce=string] [-verbose] | ||
Examples: | ||
./discourse-user-api-key -forum=community.openstreetmap.org | ||
./discourse-user-api-key -forum=meta.discourse.org -application=UltimateReaderWriter -scopes=read,write | ||
Options: | ||
-application string | ||
name of application shown on forum site (default "GenericDiscourseReader") | ||
-client string | ||
client ID (default [generated unique UUID4]) | ||
-forum string | ||
Discourse forum URL | ||
-nonce string | ||
random string generated once (default [generated URL-safe random string]) | ||
-scopes string | ||
comma-separated list of access scopes allowed for the key (default "read") | ||
-verbose | ||
verbose output (maybe helpful in case of problems) | ||
Workflow for getting an User-API-Key: | ||
Step 1: copy forum URL into your browser | ||
Step 2: authorize application access on forum site | ||
Step 3: copy encrypted User-API-Key data from forum site in here | ||
Step 4: save User-API-Key into your key vault | ||
``` | ||
|
||
### Example | ||
``` text | ||
% ./discourse-user-api-key -forum=community.openstreetmap.org | ||
Program: | ||
Name : discourse-user-api-key | ||
Release : v1.0.0 - 2022/10/31 | ||
Purpose : obtain Discourse User-API-Key | ||
Info : This program obtains a User-API-Key for a Discourse forum. | ||
Workflow for getting an User-API-Key: | ||
Step 1: copy forum URL into your browser | ||
Step 2: authorize application access on forum site | ||
Step 3: copy encrypted User-API-Key data from forum site in here | ||
Step 4: save User-API-Key into your key vault | ||
Step 1: copy forum URL into your browser ... | ||
https://community.openstreetmap.org/user-api-key/new?application_name=GenericDiscourseReader&client_id=47d3c48e-b6b4-4f5b-8822-6203aaa9ed97&nonce=3J9rujWeEQP_IEwasM-r6HN-sqY%3D&public_key=-----BEGIN+PUBLIC+KEY-----%0AMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo26hAwBt8dnQ93nwpFBw%0AX0KoxuskYvt7n6RN5l6NUKWsCTdC%2BGf%2Ftu2VvgTBPfgxDIfun2uIvF6n743m10qB%0AieCm8VIdPK2Yc3h4h58KfkZ4G9s%2BbJeLLv3g7uDCNMG8A2%2F8u5XSCxN%2FeuIkstvr%0AAmTBClrInJrq6pUELpgyoyZbNl1DpUl%2BX92%2FfUeGgdORHiKorAbZT4PCC5HE72pG%0AAdv45i6EvCHUfuISkB56DK4CduGH0v5dzZTXlnFi6iaNpH0pd8rJTvRCmrV9VutG%0A96fv%2B1MutjwfWaL90WJ2JwF%2FEVWfBe4cQATCVqRN5lQ79tdY5UwgPuyXS%2Big9xuB%0ALwIDAQAB%0A-----END+PUBLIC+KEY-----%0A&scopes=read | ||
Step 2: authorize application access on forum site ... | ||
Step 3: copy encrypted User-API-Key data from forum site in here (and press Enter) ... | ||
Pp7IxXlZ4Yb6nCnQfJ5htMaffA9TAaH9RztOUYvI2IssBxZXWOQ5+LOJRtqO sTWJYAUFrIwwYPhJGq5Dc4oA7VFxy8cOVDfq3VkDNw5tA1T3OGeysiIjyRC8 KbzDZdS8xYhFdIyI9rYzhbnYeCazY/33LG/4UFf+Ld1nkx0GtwLGi8D75+sK 6ECnw/oDwGMoUFLjlQ4p47mOa0bDGh7xUS2h3VO7xee13ctvj873dqRmiPuN xaTsQXtf3v9EwVAY1Hj+xqrex78yj8U3hmyEXqssoGhNn8QlVAmn8E93dcdu TeSf9fhhgSoePc1a/kiEdRTlGVMcR5+WDqfNg1wDPw== | ||
Decrypted User-API-Key data = {"key":"aa141fc6a7362231178d8d8e5609e768","nonce":"3J9rujWeEQP_IEwasM-r6HN-sqY=","push":false,"api":4} | ||
User-API-Key = aa141fc6a7362231178d8d8e5609e768 | ||
----------------------------------------------- | ||
Step 4: save User-API-Key into your key vault | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/sh | ||
|
||
# ------------------------------------ | ||
# Purpose: | ||
# - Builds assets (tar.gz or zip). | ||
# | ||
# Releases: | ||
# - v1.0.0 - 2022-10-31: initial release | ||
# ------------------------------------ | ||
|
||
# set -o xtrace | ||
set -o verbose | ||
|
||
# recreate directory | ||
rm -r ./assets | ||
mkdir ./assets | ||
|
||
# asset 'aix' | ||
tar -cvzf ./assets/aix-ppc64_discourse-user-api-key.tar.gz ./binaries/aix-ppc64/discourse-user-api-key | ||
|
||
# assets 'darwin' | ||
tar -cvzf ./assets/darwin-amd64_discourse-user-api-key.tar.gz ./binaries/darwin-amd64/discourse-user-api-key | ||
tar -cvzf ./assets/darwin-arm64_discourse-user-api-key.tar.gz ./binaries/darwin-arm64/discourse-user-api-key | ||
|
||
# assets 'dragonfly' | ||
tar -cvzf ./assets/dragonfly-amd64_discourse-user-api-key.tar.gz ./binaries/dragonfly-amd64/discourse-user-api-key | ||
|
||
# assets 'freebsd' | ||
tar -cvzf ./assets/freebsd-amd64_discourse-user-api-key.tar.gz/freebsd-amd64/discourse-user-api-key | ||
tar -cvzf ./assets/freebsd-arm64_discourse-user-api-key.tar.gz ./binaries/freebsd-arm64/discourse-user-api-key | ||
|
||
# asset 'illumos' | ||
tar -cvzf ./assets/illumos-amd64_discourse-user-api-key.tar.gz ./binaries/illumos-amd64/discourse-user-api-key | ||
|
||
# assets 'linux' | ||
tar -cvzf ./assets/linux-amd64_discourse-user-api-key.tar.gz ./binaries/linux-amd64/discourse-user-api-key | ||
tar -cvzf ./assets/linux-arm64_discourse-user-api-key.tar.gz ./binaries/linux-arm64/discourse-user-api-key | ||
tar -cvzf ./assets/linux-mips64_discourse-user-api-key.tar.gz ./binaries/linux-mips64/discourse-user-api-key | ||
tar -cvzf ./assets/linux-mips64le_discourse-user-api-key.tar.gz ./binaries/linux-mips64le/discourse-user-api-key | ||
tar -cvzf ./assets/linux-ppc64_discourse-user-api-key.tar.gz ./binaries/linux-ppc64/discourse-user-api-key | ||
tar -cvzf ./assets/linux-ppc64le_discourse-user-api-key.tar.gz ./binaries/linux-ppc64le/discourse-user-api-key | ||
tar -cvzf ./assets/linux-riscv64_discourse-user-api-key.tar.gz ./binaries/linux-riscv64/discourse-user-api-key | ||
tar -cvzf ./assets/linux-s390x_discourse-user-api-key.tar.gz ./binaries/linux-s390x/discourse-user-api-key | ||
|
||
# assets 'netbsd' | ||
tar -cvzf ./assets/netbsd-amd64_discourse-user-api-key.tar.gz ./binaries/netbsd-amd64/discourse-user-api-key | ||
tar -cvzf ./assets/netbsd-arm64_discourse-user-api-key.tar.gz ./binaries/netbsd-arm64/discourse-user-api-key | ||
|
||
# assets 'openbsd' | ||
tar -cvzf ./assets/openbsd-amd64_discourse-user-api-key.tar.gz ./binaries/openbsd-amd64/discourse-user-api-key | ||
tar -cvzf ./assets/openbsd-arm64_discourse-user-api-key.tar.gz ./binaries/openbsd-arm64/discourse-user-api-key | ||
tar -cvzf ./assets/openbsd-mips64_discourse-user-api-key.tar.gz ./binaries/openbsd-mips64/discourse-user-api-key | ||
|
||
# asset 'solaris' | ||
tar -cvzf ./assets/solaris-amd64_discourse-user-api-key.tar.gz ./binaries/solaris-amd64/discourse-user-api-key | ||
|
||
# assets 'windows' | ||
zip ./assets/windows-amd64_discourse-user-api-key.zip ./binaries/windows-amd64/discourse-user-api-key.exe | ||
zip ./assets/windows-386_discourse-user-api-key.zip ./binaries/windows-386/discourse-user-api-key.exe | ||
zip ./assets/windows-arm_discourse-user-api-key.zip ./binaries/windows-arm/discourse-user-api-key.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/sh | ||
|
||
# ------------------------------------ | ||
# Purpose: | ||
# - Builds executables / binaries. | ||
# | ||
# Releases: | ||
# - v1.0.0 - 2022-10-31: initial release | ||
# | ||
# Remarks: | ||
# - go tool dist list | ||
# ------------------------------------ | ||
|
||
# set -o xtrace | ||
set -o verbose | ||
|
||
# renew vendor content | ||
go mod vendor | ||
|
||
# compile 'aix' | ||
env GOOS=aix GOARCH=ppc64 go build -o binaries/aix-ppc64/discourse-user-api-key | ||
|
||
# compile 'darwin' | ||
env GOOS=darwin GOARCH=amd64 go build -o binaries/darwin-amd64/discourse-user-api-key | ||
env GOOS=darwin GOARCH=arm64 go build -o binaries/darwin-arm64/discourse-user-api-key | ||
|
||
# compile 'dragonfly' | ||
env GOOS=dragonfly GOARCH=amd64 go build -o binaries/dragonfly-amd64/discourse-user-api-key | ||
|
||
# compile 'freebsd' | ||
env GOOS=freebsd GOARCH=amd64 go build -o binaries/freebsd-amd64/discourse-user-api-key | ||
env GOOS=freebsd GOARCH=arm64 go build -o binaries/freebsd-arm64/discourse-user-api-key | ||
|
||
# compile 'illumos' | ||
env GOOS=illumos GOARCH=amd64 go build -o binaries/illumos-amd64/discourse-user-api-key | ||
|
||
# compile 'linux' | ||
env GOOS=linux GOARCH=amd64 go build -o binaries/linux-amd64/discourse-user-api-key | ||
env GOOS=linux GOARCH=arm64 go build -o binaries/linux-arm64/discourse-user-api-key | ||
env GOOS=linux GOARCH=mips64 go build -o binaries/linux-mips64/discourse-user-api-key | ||
env GOOS=linux GOARCH=mips64le go build -o binaries/linux-mips64le/discourse-user-api-key | ||
env GOOS=linux GOARCH=ppc64 go build -o binaries/linux-ppc64/discourse-user-api-key | ||
env GOOS=linux GOARCH=ppc64le go build -o binaries/linux-ppc64le/discourse-user-api-key | ||
env GOOS=linux GOARCH=riscv64 go build -o binaries/linux-riscv64/discourse-user-api-key | ||
env GOOS=linux GOARCH=s390x go build -o binaries/linux-s390x/discourse-user-api-key | ||
|
||
# compile 'netbsd' | ||
env GOOS=netbsd GOARCH=amd64 go build -o binaries/netbsd-amd64/discourse-user-api-key | ||
env GOOS=netbsd GOARCH=arm64 go build -o binaries/netbsd-arm64/discourse-user-api-key | ||
|
||
# compile 'openbsd' | ||
env GOOS=openbsd GOARCH=amd64 go build -o binaries/openbsd-amd64/discourse-user-api-key | ||
env GOOS=openbsd GOARCH=arm64 go build -o binaries/openbsd-arm64/discourse-user-api-key | ||
env GOOS=openbsd GOARCH=mips64 go build -o binaries/openbsd-mips64/discourse-user-api-key | ||
|
||
# compile 'solaris' | ||
env GOOS=solaris GOARCH=amd64 go build -o binaries/solaris-amd64/discourse-user-api-key | ||
|
||
# compile 'windows' | ||
env GOOS=windows GOARCH=amd64 go build -o binaries/windows-amd64/discourse-user-api-key.exe | ||
env GOOS=windows GOARCH=386 go build -o binaries/windows-386/discourse-user-api-key.exe | ||
env GOOS=windows GOARCH=arm go build -o binaries/windows-arm/discourse-user-api-key.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module klaus/discourse-user-api-key | ||
|
||
go 1.19 | ||
|
||
require github.com/gofrs/uuid v4.3.0+incompatible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= | ||
github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= |
Oops, something went wrong.