update some things
This commit is contained in:
parent
0c9b8cb6a0
commit
fd7a843576
11
aid/aid.go
11
aid/aid.go
|
@ -1,6 +1,7 @@
|
|||
package aid
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
@ -24,3 +25,13 @@ func JSONParse(input string) interface{} {
|
|||
json.Unmarshal([]byte(input), &output)
|
||||
return output
|
||||
}
|
||||
|
||||
func RandomString(n int) string {
|
||||
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
||||
|
||||
s := make([]rune, n)
|
||||
for i := range s {
|
||||
s[i] = letters[rand.Intn(len(letters))]
|
||||
}
|
||||
return string(s)
|
||||
}
|
6
main.go
6
main.go
|
@ -41,7 +41,11 @@ func init() {
|
|||
fortnite.GenerateRandomStorefront()
|
||||
|
||||
if aid.Config.Database.DropAllTables {
|
||||
fortnite.NewFortnitePerson("ac", "1")
|
||||
username := aid.RandomString(6)
|
||||
password := aid.RandomString(10)
|
||||
fortnite.NewFortnitePerson(username, password)
|
||||
|
||||
aid.Print("Admin Credentials: username", username, "password", password)
|
||||
}
|
||||
|
||||
fortnite.GeneratePlaylistImages()
|
||||
|
|
|
@ -15,6 +15,7 @@ type Person struct {
|
|||
Profile0Profile *Profile
|
||||
CollectionsProfile *Profile
|
||||
CreativeProfile *Profile
|
||||
DiscordID string
|
||||
Discord *storage.DB_DiscordPerson
|
||||
}
|
||||
|
||||
|
@ -142,10 +143,10 @@ func findHelper(databasePerson *storage.DB_Person) *Person {
|
|||
CollectionsProfile: collectionsProfile,
|
||||
CreativeProfile: creativeProfile,
|
||||
Discord: &databasePerson.Discord,
|
||||
DiscordID: databasePerson.DiscordID,
|
||||
}
|
||||
|
||||
cache.SavePerson(person)
|
||||
|
||||
return person
|
||||
}
|
||||
|
||||
|
@ -201,7 +202,9 @@ func (p *Person) ToDatabase() *storage.DB_Person {
|
|||
ID: p.ID,
|
||||
DisplayName: p.DisplayName,
|
||||
Profiles: []storage.DB_Profile{},
|
||||
Stats: []storage.DB_SeasonStat{},
|
||||
AccessKey: p.AccessKey,
|
||||
DiscordID: p.DiscordID,
|
||||
}
|
||||
|
||||
if p.Discord != nil {
|
||||
|
@ -285,5 +288,6 @@ func (p *Person) Snapshot() *PersonSnapshot {
|
|||
CollectionsProfile: *p.CollectionsProfile.Snapshot(),
|
||||
CreativeProfile: *p.CreativeProfile.Snapshot(),
|
||||
Discord: *p.Discord,
|
||||
DiscordID: p.DiscordID,
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ type PersonSnapshot struct {
|
|||
CollectionsProfile ProfileSnapshot
|
||||
CreativeProfile ProfileSnapshot
|
||||
Discord storage.DB_DiscordPerson
|
||||
DiscordID string
|
||||
}
|
||||
|
||||
type ProfileSnapshot struct {
|
||||
|
|
|
@ -12,6 +12,7 @@ type DB_Person struct {
|
|||
AccessKey string
|
||||
Profiles []DB_Profile `gorm:"foreignkey:PersonID"`
|
||||
Stats []DB_SeasonStat `gorm:"foreignkey:PersonID"`
|
||||
DiscordID string
|
||||
Discord DB_DiscordPerson `gorm:"foreignkey:PersonID"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user