Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
zekroTJA committed Nov 11, 2022
2 parents 330e81d + 76e217a commit b2734ad
Show file tree
Hide file tree
Showing 59 changed files with 4,201 additions and 2,564 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/artifacts-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.18'
go-version: '1.19'
- name: Check out code
uses: actions/checkout@v2
- name: Retrieve frontend files
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releases-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.18'
go-version: '1.19'
- name: Check out code
uses: actions/checkout@v2
- name: Retrieve frontend files
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/setup-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.18'
go-version: '1.19'
- name: Check out code
uses: actions/checkout@v2
- name: Get dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.18'
go-version: '1.19'

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down
35 changes: 14 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,29 @@
<!-- > **Attention**
> This is a hotfix patch. If you want to see the changelog for release 1.30.0, please look [**here**](https://github.com/zekroTJA/shinpuru/releases/tag/1.30.0). -->

# Message Components [#320]
# Role Selection [#363]

With release [v0.17.0](https://github.com/zekroTJA/ken/releases/tag/v0.17.0) and [v0.17.1](https://github.com/zekroTJA/ken/releases/tag/v0.17.1), message components have now been added to shinpuru.
Added a new command [`/roleselect`](https://github.com/zekroTJA/shinpuru/wiki/Commands#roleselect) which you can use to create a role selection message. Alternatively, you can also attach role selection to a message which has been sent by shinpuru *(for example using [`/say`](https://github.com/zekroTJA/shinpuru/wiki/Commands#say))*.

The [`acceptmsg` package](pkg/acceptmsg) now uses message components to accept and decline the message.
https://user-images.githubusercontent.com/16734205/201224685-1393c46a-891e-4963-beea-b93ddbbba142.mp4

![](https://user-images.githubusercontent.com/16734205/187892843-22cc6e0e-a838-40cc-a24d-2d957fd5d4d7.png)
# Discord OAuth Handling

Step by step, more commands and services will be adapted to message components and modals. One of the first commands using message components and modals is the `/backup` slash command.
The login to shinpuru using the Discord OAuth2 flow is now taking advantage of passing a `state` parameter to the authentication redirect. This state is a JWT signed with a token randomly generated on startup. This secures the login-process against any type of cross-site request forgery attacks.

<!-- TODO: Add GIF. -->
Also, this allows to pass additional information through the login process like redirection targets. Therefore, when you log in to the beta web interface, you are now also redirected back to the beta interface after the login instead of being redirected to the main interface.

# "Postban" System [#383]
# Bug Fixes

A new "postban" system has been implemented which detects when a user has been banned manually (directly using the Discord utilities) and sends a notice message into the mod log channel afterwards. Then, you are able to import the ban into the shinpuru report system. You are also able to edit the reason specified in the ban and also add an attachment via an URL.
- When you go to `shnp.de/beta`, you will now be redirected to the login page if not logged in. [#388]
- Fixed a typo in the anti-raid notification message. [#389]
- Fixed command manual generation. [#391]

<!-- TODO: Add GIF. -->
# Beta Web Interface

# Minor Changes

- The mime fix utility has now been removed because the issue [has been fixed in the go language](https://go-review.googlesource.com/c/go/+/406894/).
- Add code execution guild settings to the new beta web interface.

# Code Base

The `Makefile` in this repository - which is primarily there to simplify common prep, build, test and deploy tasks - will be swaped out in favor of [`Taskfile`](https://taskfile.dev) which has a lot of advantages over make - especially in this environment.

If you don't have taskfile installed, please head to [taskfile.dev/installation](https://taskfile.dev/installation/) to find out how to install taskfile on your system.

Currently, the `Makefile` will be kept in the repository for compatibility reasons but will be removed in upcoming updates.
- Guild Settings: Verification Route implemented
- Guild Settings: Code Execution Route implemented
- Guild Settings: Karma Route implemented

# Docker

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ------------------------------------------------------------
# --- STAGE 1: Build Backend and Go Tools
FROM golang:1.18-alpine AS build-be
FROM golang:1.19-alpine AS build-be
WORKDIR /build

# Copy source files
Expand Down
173 changes: 0 additions & 173 deletions Makefile

This file was deleted.

8 changes: 2 additions & 6 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ tasks:
build-be:
desc:
Builds the backend binary.
sources:
- cmd/**
- internal/**
- pkg/**
cmds:
- task: embed-versions
vars: { RELEASE: "{{.RELEASE}}" }
Expand Down Expand Up @@ -108,7 +104,7 @@ tasks:
- index.html
- "*.png"
cmds:
- yarn run build
- yarn run build --base=/beta/

init-dev:
desc:
Expand Down Expand Up @@ -152,7 +148,7 @@ tasks:
- deps-fe-new
dir: web.new
cmds:
- yarn start
- yarn start --base=/beta/

test:
desc:
Expand Down
12 changes: 9 additions & 3 deletions cmd/cmdman/v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,12 @@ func groupCommandInfo(cmdInfo ken.CommandInfoList) (m map[string][]*ken.CommandI
func groupNameFromDomain(domain string) (group string) {
domainSplit := strings.Split(domain, ".")
group = strings.Join(domainSplit[1:len(domainSplit)-1], " ")
group = strings.ToUpper(group)
return

if group == "" {
group = "uncategorized"
}

return strings.ToUpper(group)
}

func writeCommandList(document *strings.Builder, groups map[string][]*ken.CommandInfo) {
Expand Down Expand Up @@ -174,6 +178,8 @@ func writeCommandDetails(document *strings.Builder, cmd *ken.CommandInfo) {

domain := cmd.Implementations["Domain"][0].(string)

logrus.Infof("Writing command %s.%s", domain, cmd.ApplicationCommand.Name)

fmt.Fprintf(document, "### %s\n\n", cmd.ApplicationCommand.Name)
fmt.Fprintf(document, "%s\n\n", cmd.ApplicationCommand.Description)
fmt.Fprintf(document,
Expand Down Expand Up @@ -236,7 +242,7 @@ func writeArguments(document *strings.Builder, options []*discordgo.ApplicationC
"|------|------|----------|-------------|---------|\n")
for _, opt := range options {
fmt.Fprintf(document,
"| %s | `%s` | `%t` | %s | %s |",
"| %s | `%s` | `%t` | %s | %s |\n",
opt.Name,
opt.Type.String(),
opt.Required,
Expand Down
Loading

0 comments on commit b2734ad

Please sign in to comment.