HEAVY: migrate accounts and logs to service/repo architecture
This commit is contained in:
parent
5c255fb34b
commit
49e14b5bc5
37 changed files with 1019 additions and 687 deletions
|
|
@ -1,13 +1,13 @@
|
|||
package discord
|
||||
|
||||
import (
|
||||
"arimelody-web/model"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"arimelody-web/model/app"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const API_ENDPOINT = "https://discord.com/api/v10"
|
||||
|
|
@ -47,7 +47,7 @@ type (
|
|||
}
|
||||
)
|
||||
|
||||
func GetOAuthTokenFromCode(app *model.AppState, code string) (string, error) {
|
||||
func GetOAuthTokenFromCode(app *app.AppState, code string) (string, error) {
|
||||
// let's get an oauth token!
|
||||
req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("%s/oauth2/token", API_ENDPOINT),
|
||||
strings.NewReader(url.Values{
|
||||
|
|
@ -99,7 +99,7 @@ func GetOAuthCallbackURI(baseURL string) string {
|
|||
return fmt.Sprintf("%s/admin/login", baseURL)
|
||||
}
|
||||
|
||||
func GetRedirectURI(app *model.AppState) string {
|
||||
func GetRedirectURI(app *app.AppState) string {
|
||||
return fmt.Sprintf(
|
||||
"https://discord.com/oauth2/authorize?client_id=%s&response_type=code&redirect_uri=%s&scope=identify",
|
||||
app.Config.Discord.ClientID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue