Skip to content

Commit

Permalink
Merge pull request #188 from zekroTJA/dev
Browse files Browse the repository at this point in the history
WIP: release 1.5.0
  • Loading branch information
zekroTJA authored Nov 20, 2020
2 parents 7fe22b9 + bd829d0 commit 6b190f5
Show file tree
Hide file tree
Showing 68 changed files with 1,853 additions and 584 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/tests-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Unit Tests

on:
push:
branches:
- '*'
paths-ignore:
- '**.md'

jobs:

tests:

name: Tests
runs-on: ubuntu-latest

steps:

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.14

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Run tests
run: |
go test -v -cover github.com/zekroTJA/shinpuru/pkg/...
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Main CI
name: Commands Wiki Generation

on:
push:
Expand Down
48 changes: 20 additions & 28 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,48 @@
1.4.0
1.5.0

> MAJOR PATCH
## Major Implementations

### Antiraid System [#159]
### Landing Page

A new guild security feature has been added to shinpuru: The Antiraid System.
shinpurus `/login` page is now decorated by a landing page which shows off some of shinpurus core features, some invite links and options to self host as well as some links to dive deeper.

> **What is a "Raid"?**
> A guild raid is mostly refered to a large, burst-like ammount of accounts joining the guild in a short period of time. This is mostly caused by a single user or a group of users which utilize bot-created or hijacked accounts to flood a guild.
> This page is still in a kind of **beta state**. A lot of stuff is still missing like proper support for mobile devices as well as further feature spotlights.
To counteract this, the antiraid system constantly checks the rate of users joining your guild. If the rate increases over a certain threshold, the antiraid system triggers. Following, the guilds security level is raised to `verry high` and for the following 24 hours, all users joining the guild are logged in a list which is accessable via the web interface. Also, all admins of the guild will be informed about the incident.
![](https://i.imgur.com/4V6VVab.gif)

Of course, the antiraid system can be toggled and the trigger threshold values can be managed in the web interface *(if you have the `sp.guild.config.antiraid` permission)*.
![](https://i.imgur.com/vLMgrM9.png)

### Metrics Monitoring [#170]

You are now able to monitor core metrics of shinpuru using Prometheus and Grafana.

You can enable the prometheus scraping endpoint by adding this to your shinpuru config:
```yml
metrics:
enable: true
addr: ":9091"
```
## Minor Updates

[Here](https://github.com/zekroTJA/shinpuru/blob/master/config/prometheus/prometheus.yml) you can find an example Prometheus configuration and [here](https://github.com/zekroTJA/shinpuru/blob/master/config/grafana/example-dashboard.json) you can find an example grafana dashboard to monitor shinpuru's metrics.
- Two imporvements of the color feature:
1. A name of the color which is closest to the specified color is now displayed. This is provided by the [`zekroTJA/colorname`](https://github.com/zekroTJA/colorname) package.
2. The name of the embed executor is now displayed in the embed footer. [#183]

*Example dashboard. Data from shinpuru Canary instance.*
![](https://i.imgur.com/fEkV7fe.png)
![](https://i.imgur.com/4dzBN8z.png)

- You are now able to chat mute/unmute members via the web interface. [#187]
![](https://i.imgur.com/dUJmuqy.png)

## Minor Updates
- The web server endpoint `/invite` now redirects to the invite link of the current shinpuru instance (e.g. https://shnp.de/invite).

- Add aliases to `karma` command: `leaderboard`, `lb`, `sb` and `top`. [#181]
- The `karma` command now shows the karma points of a user when specified as argument. [#179]
- The `exec` command now shows the ammount of consumed JDoodle API tokens, when activated.

## Bug Fixes

- The web frontend route `/guilds/:guildid/guildadmin` now redirects to `/guilds/:guildid/guildadmin/antiraid` instead of firing errors. [#180]
- Fix hex notation of color reaction embeds.
- Fix a bug in the jdoodle listener which caused missing line breaks on pushing the snippet to the JDoodle API. [#186]
- Fix the label of the Prometheus metric `discord_commands_processed_total`.

## Backstage

- Updated a bit of the project structure: The packages `listeners` and `webserver` are now moved into the `internal/core` package.
- Moved `stringutils` package to `pkg/stringutils`.
- Moved `jdoodle` package to `pkg/jdoodle`.

# Docker

[Here](https://hub.docker.com/r/zekro/shinpuru) you can find the docker hub page of shinpuru.

Pull the docker image of this release:
```
$ docker pull zekro/shinpuru:1.4.0
$ docker pull zekro/shinpuru:1.5.0
```
80 changes: 63 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,68 @@ Read about self-compiling in the [**wiki article**](https://github.com/zekroTJA/

Some of the independant utilities and functionalities shinpuru uses are publicly available via `go get <package>`. I will try to keep the API and general behaviour of those functionalities as "frozen" as possible to make those packages long-time reliable.

- [`github.com/zekroTJA/shinpuru/pkg/acceptmsg`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/acceptmsg)
- [`github.com/zekroTJA/shinpuru/pkg/angularservice`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/angularservice)
- [`github.com/zekroTJA/shinpuru/pkg/bytecount`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/bytecount)
- [`github.com/zekroTJA/shinpuru/pkg/ctypes`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/ctypes)
- [`github.com/zekroTJA/shinpuru/pkg/discordoauth`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/discordoauth)
- [`github.com/zekroTJA/shinpuru/pkg/discordutil`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/discordutil)
- [`github.com/zekroTJA/shinpuru/pkg/etag`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/etag)
- [`github.com/zekroTJA/shinpuru/pkg/fetch`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/fetch)
- [`github.com/zekroTJA/shinpuru/pkg/httpreq`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/httpreq)
- [`github.com/zekroTJA/shinpuru/pkg/lctimer`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/lctimer)
- [`github.com/zekroTJA/shinpuru/pkg/msgcollector`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/msgcollector)
- [`github.com/zekroTJA/shinpuru/pkg/multierror`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/multierror)
- [`github.com/zekroTJA/shinpuru/pkg/permissions`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/permissions)
- [`github.com/zekroTJA/shinpuru/pkg/random`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/random)
- [`github.com/zekroTJA/shinpuru/pkg/roleutil`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/roleutil)
- [`github.com/zekroTJA/shinpuru/pkg/timeutil`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/timeutil)
- [`github.com/zekroTJA/shinpuru/pkg/twitchnotify`](https://github.com/zekroTJA/shinpuru/tree/master/pkg/twitchnotify)
- [**`github.com/zekroTJA/shinpuru/pkg/acceptmsg`**](pkg/acceptmsg)
*Package acceptmsg provides a message model for discordgo which can be accepted or declined via message reactions.*

- [**`github.com/zekroTJA/shinpuru/pkg/angularservice`**](pkg/angularservice)
*Package angularservice provides bindings to start an Angular development server via the Angular CLI.*

- [**`github.com/zekroTJA/shinpuru/pkg/bytecount`**](pkg/bytecount)
*Package bytecount provides functionalities to format byte counts.*

- [**`github.com/zekroTJA/shinpuru/pkg/colors`**](pkg/colors)
*Package color provides general utilities for image/color objects and color codes.*

- [**`github.com/zekroTJA/shinpuru/pkg/ctypes`**](pkg/ctypes)
*Package ctype provides some custom types with useful function extensions.*

- [**`github.com/zekroTJA/shinpuru/pkg/discordoauth`**](pkg/discordoauth)
*package discordoauth provides fasthttp handlers to authenticate with via the Discord OAuth2 endpoint.*

- [**`github.com/zekroTJA/shinpuru/pkg/discordutil`**](pkg/discordutil)
*Package discordutil provides general purpose extensuion functionalities for discordgo.*

- [**`github.com/zekroTJA/shinpuru/pkg/etag`**](pkg/etag)
*Package etag implements generation functionalities for the ETag specification of RFC7273 2.3. https://tools.ietf.org/html/rfc7232#section-2.3.1*

- [**`github.com/zekroTJA/shinpuru/pkg/fetch`**](pkg/fetch)
*Package fetch provides functionalities to fetch roles, channels, members and users by so called resolavbles. That means, these functions try to match a member, role or channel by their names, displaynames, IDs or mentions as greedy as prossible.*

- [**`github.com/zekroTJA/shinpuru/pkg/httpreq`**](pkg/httpreq)
*Package httpreq provides general utilities for around net/http requests for a simpler API and extra utilities for parsing JSON request and response boddies.*

- [**`github.com/zekroTJA/shinpuru/pkg/jdoodle`**](pkg/jdoodle)
*Package jdoodle provides an API wrapper for the jdoodle execute and credits-spent REST API.*

- [**`github.com/zekroTJA/shinpuru/pkg/lctimer`**](pkg/lctimer)
*Package lctimer provides a life cycle timer which calls registered callback handlers on timer elapse.*

- [**`github.com/zekroTJA/shinpuru/pkg/msgcollector`**](pkg/msgcollector)
*Package msgcollector provides functionalities to collect messages in a channel in conect of a single command request.*

- [**`github.com/zekroTJA/shinpuru/pkg/multierror`**](pkg/multierror)
*Package multierror impements handling multiple errors as one error object. Authors: Ringo Hoffmann.*

- [**`github.com/zekroTJA/shinpuru/pkg/permissions`**](pkg/permissions)
*Package permissions provides functionalities to calculate, update and merge arrays of permission domain rules. Read this to get more information about how permission domains and rules are working: https://github.com/zekroTJA/shinpuru/wiki/Permissions-Guide*

- [**`github.com/zekroTJA/shinpuru/pkg/random`**](pkg/random)
*Package random provides some general purpose cryptographically pseudo-random utilities.*

- [**`github.com/zekroTJA/shinpuru/pkg/roleutil`**](pkg/roleutil)
*Package roleutil provides general purpose utilities for discordgo.Role objects and arrays.*

- [**`github.com/zekroTJA/shinpuru/pkg/stringutil`**](pkg/stringutil)
*Package stringutil provides generl string utility functions.*

- [**`github.com/zekroTJA/shinpuru/pkg/timeutil`**](pkg/timeutil)
*Package timeutil provides some general purpose functionalities around the time package.*

- [**`github.com/zekroTJA/shinpuru/pkg/twitchnotify`**](pkg/twitchnotify)
*Package twitchnotify provides functionalities to watch the state of twitch streams and notifying changes by polling the twitch REST API.*

- [**`github.com/zekroTJA/shinpuru/pkg/voidbuffer`**](pkg/voidbuffer)
*Package voidbuffer provides a simple, concurrency proof push buffer with a fixed size which "removes" firstly pushed values when fully filled.*

---

Expand All @@ -180,6 +225,7 @@ Some of the independant utilities and functionalities shinpuru uses are publicly
- [op/go-logging](https://github.com/op/go-logging)
- [valyala/fasthttp ](https://github.com/valyala/fasthttp)
- [wcharczuk/go-chart](https://github.com/wcharczuk/go-chart)
- [zekroTJA/colorname](https://github.com/zekroTJA/colorname)
- [zekroTJA/ratelimit](https://github.com/zekroTJA/ratelimit)
- [zekroTJA/shireikan](https://github.com/zekroTJA/shireikan)
- [zekroTJA/timedmap](https://github.com/zekroTJA/timedmap)
Expand Down
3 changes: 2 additions & 1 deletion bughunters.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A list to honor all people who found some bugs, had some great ideas or contribu

| GitHub | Issues | PRs | Points* |
|--------|--------|-----|---------|
| [voxain](https://github.com/voxain) | [#52](https://github.com/zekroTJA/shinpuru/issues/52), [#61](https://github.com/zekroTJA/shinpuru/issues/61), [#67](https://github.com/zekroTJA/shinpuru/issues/67), [#147](https://github.com/zekroTJA/shinpuru/issues/147), [#148](https://github.com/zekroTJA/shinpuru/issues/148), [#150](https://github.com/zekroTJA/shinpuru/issues/150), [#153](https://github.com/zekroTJA/shinpuru/issues/153), [#159](https://github.com/zekroTJA/shinpuru/issues/159), [#163](https://github.com/zekroTJA/shinpuru/issues/163), [#165](https://github.com/zekroTJA/shinpuru/issues/165) | | `10` |
| [voxain](https://github.com/voxain) | [#52](https://github.com/zekroTJA/shinpuru/issues/52), [#61](https://github.com/zekroTJA/shinpuru/issues/61), [#67](https://github.com/zekroTJA/shinpuru/issues/67), [#147](https://github.com/zekroTJA/shinpuru/issues/147), [#148](https://github.com/zekroTJA/shinpuru/issues/148), [#150](https://github.com/zekroTJA/shinpuru/issues/150), [#153](https://github.com/zekroTJA/shinpuru/issues/153), [#159](https://github.com/zekroTJA/shinpuru/issues/159), [#163](https://github.com/zekroTJA/shinpuru/issues/163), [#165](https://github.com/zekroTJA/shinpuru/issues/165), [#183](https://github.com/zekroTJA/shinpuru/issues/183), [#187](https://github.com/zekroTJA/shinpuru/issues/187) | | `12` |
| [SnowLeoo](https://github.com/SnowLeoo) | [#129](https://github.com/zekroTJA/shinpuru/issues/129), [#145](https://github.com/zekroTJA/shinpuru/issues/145), [#169](https://github.com/zekroTJA/shinpuru/issues/169) | [#175](https://github.com/zekroTJA/shinpuru/pull/175), [#176](https://github.com/zekroTJA/shinpuru/pull/176), [#178](https://github.com/zekroTJA/shinpuru/pull/178) | `9` |
| [error2507](https://github.com/error2507) | [#28](https://github.com/zekroTJA/shinpuru/issues/28), [#29](https://github.com/zekroTJA/shinpuru/issues/29), [#55](https://github.com/zekroTJA/shinpuru/issues/55) | [#1](https://github.com/zekroTJA/shinpuru/pull/1), [#2](https://github.com/zekroTJA/shinpuru/pull/2) | `7` |
| [Ron31](https://github.com/Ron31) | | [#32](https://github.com/zekroTJA/shinpuru/pull/32), [#181](https://github.com/zekroTJA/shinpuru/pull/181) | `4` |
Expand All @@ -21,6 +21,7 @@ A list to honor all people who found some bugs, had some great ideas or contribu
| [Zoriot](https://github.com/Zoriot) | [#128](https://github.com/zekroTJA/shinpuru/issues/128) | | `1` |
| [okrplay](https://github.com/okrplay) | [#162](https://github.com/zekroTJA/shinpuru/issues/162) | | `1` |
| [cloudybyte](https://github.com/cloudybyte) | [#179](https://github.com/zekroTJA/shinpuru/issues/179) | | `1` |
| [ENOT1KK](https://github.com/ENOT1KK) | [#184](https://github.com/zekroTJA/shinpuru/issues/184) | | `1` |


---
Expand Down
3 changes: 2 additions & 1 deletion cmd/cmdman/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/zekroTJA/shinpuru/internal/core/middleware"
"github.com/zekroTJA/shinpuru/internal/inits"
"github.com/zekroTJA/shinpuru/internal/util"
"github.com/zekroTJA/shinpuru/pkg/stringutil"
"github.com/zekroTJA/shireikan"
)

Expand Down Expand Up @@ -131,7 +132,7 @@ func exportCommandManual(cmdHandler shireikan.Handler, fileName string) error {
"**Usage** \n"+
"%s\n\n",
cmd.GetInvokes()[0], cmd.GetDescription(), cmd.GetDomainName(), cmd.GetGroup(),
aliases, util.BoolAsString(cmd.IsExecutableInDMChannels(), "Yes", "No"), help)
aliases, stringutil.FromBool(cmd.IsExecutableInDMChannels(), "Yes", "No"), help)

if spr := cmd.GetSubPermissionRules(); spr != nil {
cmdDetails += "\n**Sub Permission Rules**\n"
Expand Down
50 changes: 26 additions & 24 deletions cmd/shinpuru/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,32 @@ func main() {
conf.WebServer.Addr = ":8080"
}

// -----> DEV MODE INITIALIZATIONS
if *flagDevMode {
if util.Release == "TRUE" {
util.Log.Fatal("development mode is not available in production builds")
}

util.DevModeEnabled = true

// Angular dev server
angServ := angularservice.New(angularservice.Options{
Stdout: os.Stdout,
Stderr: os.Stderr,
Cd: "web",
Port: 8081,
})
util.Log.Info("Starting Angular dev server...")
if err = angServ.Start(); err != nil {
util.Log.Fatalf("Failed starting Angular dev server: %s", err.Error())
}
defer func() {
util.Log.Info("Shutting down Angular dev server...")
angServ.Stop()
}()
}
// <----- DEV MODE INITIALIZATIONS

// Setting log level from config
util.SetLogLevel(conf.Logging.LogLevel)

Expand Down Expand Up @@ -129,30 +155,6 @@ func main() {
// Initialize web server
inits.InitWebServer(session, database, st, cmdHandler, lct, conf, pmw)

// -----> DEV MODE INITIALIZATIONS
if *flagDevMode {
if util.Release == "TRUE" {
util.Log.Fatal("development mode is not available in production builds")
}

// Angular dev server
angServ := angularservice.New(angularservice.Options{
Stdout: os.Stdout,
Stderr: os.Stderr,
Cd: "web",
Port: 8081,
})
util.Log.Info("Starting Angular dev server...")
if err = angServ.Start(); err != nil {
util.Log.Fatalf("Failed starting Angular dev server: %s", err.Error())
}
defer func() {
util.Log.Info("Shutting down Angular dev server...")
angServ.Stop()
}()
}
// <----- DEV MODE INITIALIZATIONS

// Block main go routine until one of the following
// specified exit syscalls occure.
util.Log.Info("Started event loop. Stop with CTRL-C...")
Expand Down
Loading

0 comments on commit 6b190f5

Please sign in to comment.