my god...it's finally done

This commit is contained in:
ari melody 2024-09-03 08:07:45 +01:00
parent 2baf71214e
commit 19d76ebc47
Signed by: ari
GPG key ID: CF99829C92678188
43 changed files with 1008 additions and 550 deletions

View file

@ -6,26 +6,27 @@ import (
"fmt"
"net/http"
"net/url"
"os"
"strings"
"arimelody.me/arimelody.me/global"
"arimelody-web/global"
)
const API_ENDPOINT = "https://discord.com/api/v10"
var CREDENTIALS_PROVIDED = true
var CLIENT_ID = func() string {
id := global.Args["discordClient"]
id := os.Getenv("DISCORD_CLIENT")
if id == "" {
fmt.Printf("WARN: Discord client ID (-discordClient) was not provided. Admin login will be unavailable.\n")
fmt.Printf("WARN: Discord client ID (DISCORD_CLIENT) was not provided. Admin login will be unavailable.\n")
CREDENTIALS_PROVIDED = false
}
return id
}()
var CLIENT_SECRET = func() string {
secret := global.Args["discordSecret"]
if secret== "" {
fmt.Printf("WARN: Discord secret (-discordSecret) was not provided. Admin login will be unavailable.\n")
secret := os.Getenv("DISCORD_SECRET")
if secret == "" {
fmt.Printf("WARN: Discord secret (DISCORD_SECRET) was not provided. Admin login will be unavailable.\n")
CREDENTIALS_PROVIDED = false
}
return secret
@ -107,7 +108,6 @@ func GetDiscordUserFromAuth(token string) (DiscordUser, error) {
}
auth_info := AuthInfoResponse{}
err = json.NewDecoder(res.Body).Decode(&auth_info)
if err != nil {
return DiscordUser{}, errors.New(fmt.Sprintf("Failed to parse auth information from discord: %s\n", err))