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
|
package aid
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
@ -24,3 +25,13 @@ func JSONParse(input string) interface{} {
|
||||||
json.Unmarshal([]byte(input), &output)
|
json.Unmarshal([]byte(input), &output)
|
||||||
return 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()
|
fortnite.GenerateRandomStorefront()
|
||||||
|
|
||||||
if aid.Config.Database.DropAllTables {
|
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()
|
fortnite.GeneratePlaylistImages()
|
||||||
|
|
|
@ -15,6 +15,7 @@ type Person struct {
|
||||||
Profile0Profile *Profile
|
Profile0Profile *Profile
|
||||||
CollectionsProfile *Profile
|
CollectionsProfile *Profile
|
||||||
CreativeProfile *Profile
|
CreativeProfile *Profile
|
||||||
|
DiscordID string
|
||||||
Discord *storage.DB_DiscordPerson
|
Discord *storage.DB_DiscordPerson
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,10 +143,10 @@ func findHelper(databasePerson *storage.DB_Person) *Person {
|
||||||
CollectionsProfile: collectionsProfile,
|
CollectionsProfile: collectionsProfile,
|
||||||
CreativeProfile: creativeProfile,
|
CreativeProfile: creativeProfile,
|
||||||
Discord: &databasePerson.Discord,
|
Discord: &databasePerson.Discord,
|
||||||
|
DiscordID: databasePerson.DiscordID,
|
||||||
}
|
}
|
||||||
|
|
||||||
cache.SavePerson(person)
|
cache.SavePerson(person)
|
||||||
|
|
||||||
return person
|
return person
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +202,9 @@ func (p *Person) ToDatabase() *storage.DB_Person {
|
||||||
ID: p.ID,
|
ID: p.ID,
|
||||||
DisplayName: p.DisplayName,
|
DisplayName: p.DisplayName,
|
||||||
Profiles: []storage.DB_Profile{},
|
Profiles: []storage.DB_Profile{},
|
||||||
|
Stats: []storage.DB_SeasonStat{},
|
||||||
AccessKey: p.AccessKey,
|
AccessKey: p.AccessKey,
|
||||||
|
DiscordID: p.DiscordID,
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.Discord != nil {
|
if p.Discord != nil {
|
||||||
|
@ -285,5 +288,6 @@ func (p *Person) Snapshot() *PersonSnapshot {
|
||||||
CollectionsProfile: *p.CollectionsProfile.Snapshot(),
|
CollectionsProfile: *p.CollectionsProfile.Snapshot(),
|
||||||
CreativeProfile: *p.CreativeProfile.Snapshot(),
|
CreativeProfile: *p.CreativeProfile.Snapshot(),
|
||||||
Discord: *p.Discord,
|
Discord: *p.Discord,
|
||||||
|
DiscordID: p.DiscordID,
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,6 +12,7 @@ type PersonSnapshot struct {
|
||||||
CollectionsProfile ProfileSnapshot
|
CollectionsProfile ProfileSnapshot
|
||||||
CreativeProfile ProfileSnapshot
|
CreativeProfile ProfileSnapshot
|
||||||
Discord storage.DB_DiscordPerson
|
Discord storage.DB_DiscordPerson
|
||||||
|
DiscordID string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProfileSnapshot struct {
|
type ProfileSnapshot struct {
|
||||||
|
|
|
@ -12,6 +12,7 @@ type DB_Person struct {
|
||||||
AccessKey string
|
AccessKey string
|
||||||
Profiles []DB_Profile `gorm:"foreignkey:PersonID"`
|
Profiles []DB_Profile `gorm:"foreignkey:PersonID"`
|
||||||
Stats []DB_SeasonStat `gorm:"foreignkey:PersonID"`
|
Stats []DB_SeasonStat `gorm:"foreignkey:PersonID"`
|
||||||
|
DiscordID string
|
||||||
Discord DB_DiscordPerson `gorm:"foreignkey:PersonID"`
|
Discord DB_DiscordPerson `gorm:"foreignkey:PersonID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user