Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Remilia Scarlet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reviath
Remilia Scarlet
Commits
f52b4946
Commit
f52b4946
authored
May 14, 2021
by
Reviath
Browse files
Options
Downloads
Patches
Plain Diff
Added Makefile
parent
974d7af3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
Makefile
+23
-0
23 additions, 0 deletions
Makefile
web/web.go
+20
-0
20 additions, 0 deletions
web/web.go
with
44 additions
and
0 deletions
.gitignore
0 → 100644
+
1
−
0
View file @
f52b4946
/build
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Makefile
0 → 100644
+
23
−
0
View file @
f52b4946
.NOTPARALLEL
:
static-arg nowindowsgui build start
SHELL
=
sh
all
:
build
static
:
static-arg build
run
:
nowindowsgui build start
.PHONY
:
static-arg
static-arg
:
$(
eval
STATIC_LDFLAGS
=
-extldflags
"-static"
)
.PHONY
:
nowindowsgui
nowindowsgui
:
$(
eval
WINDOW_LDFLAGS
=
)
.PHONY
:
build
build
:
@
echo
"Building ..."
@
go build
-tags
=
jsoniter
-ldflags
=
"
$(
LDFLAGS
)
$(
STATIC_LDFLAGS
)
$(
WINDOW_LDFLAGS
)
"
-o
build/remiliascarlet
$(
shell go
env
GOEXE
)
$$
PWD/main.go
.PHONY
:
start
start
:
@
./build/remiliascarlet
This diff is collapsed.
Click to expand it.
web/web.go
+
20
−
0
View file @
f52b4946
...
...
@@ -8,6 +8,7 @@ import (
"net/http"
"time"
multiplexer
"git.randomchars.net/Reviath/RemiliaScarlet/Multiplexer"
"git.randomchars.net/Reviath/RemiliaScarlet/config"
"github.com/bwmarrin/discordgo"
"github.com/gin-gonic/gin"
...
...
@@ -89,6 +90,25 @@ func Listen(session *discordgo.Session) {
if
err
!=
nil
{
c
.
Redirect
(
http
.
StatusTemporaryRedirect
,
"/"
)
}
else
{
var
token
=
&
oauth2
.
Token
{}
jsoniter
.
UnmarshalFromString
(
fmt
.
Sprint
(
val
),
token
)
res
,
err
:=
conf
.
Client
(
context
.
TODO
(),
token
)
.
Get
(
"https://discordapp.com/api/v8/users/@me"
)
if
err
!=
nil
||
res
.
StatusCode
!=
200
{
fmt
.
Println
(
"An error occurred on api: "
+
err
.
Error
())
return
}
var
user
discordgo
.
User
data
,
_
:=
ioutil
.
ReadAll
(
res
.
Body
)
err
=
json
.
Unmarshal
(
data
,
&
user
)
if
err
!=
nil
{
c
.
Redirect
(
http
.
StatusTemporaryRedirect
,
"/"
)
}
if
!
multiplexer
.
CheckAdministratorPermission
(
session
,
user
.
ID
,
guild
.
SystemChannelID
)
{
fmt
.
Fprintf
(
c
.
Writer
,
"Unauthorized"
)
return
}
fmt
.
Fprintf
(
c
.
Writer
,
guild
.
Name
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment