Removed games integration

This commit is contained in:
Eduard Urbach 2021-11-20 21:26:51 +09:00
parent 9368689019
commit 0a41069e4a
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
21 changed files with 3 additions and 512 deletions

View File

@ -6,7 +6,6 @@ import (
"path" "path"
"github.com/animenotifier/anilist" "github.com/animenotifier/anilist"
"github.com/animenotifier/osu"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
) )
@ -57,10 +56,6 @@ type APIKeysData struct {
Secret string `json:"secret"` Secret string `json:"secret"`
} `json:"anilist"` } `json:"anilist"`
Osu struct {
Secret string `json:"secret"`
} `json:"osu"`
PayPal struct { PayPal struct {
ID string `json:"id"` ID string `json:"id"`
Secret string `json:"secret"` Secret string `json:"secret"`
@ -111,9 +106,6 @@ func init() {
panic(err) panic(err)
} }
// Set Osu API key
osu.APIKey = APIKeys.Osu.Secret
// Set Anilist API keys // Set Anilist API keys
anilist.APIKeyID = APIKeys.AniList.ID anilist.APIKeyID = APIKeys.AniList.ID
anilist.APIKeySecret = APIKeys.AniList.Secret anilist.APIKeySecret = APIKeys.AniList.Secret

View File

@ -104,16 +104,6 @@ func (track *SoundTrack) Anime() []*Anime {
return animeList return animeList
} }
// OsuBeatmaps returns all osu beatmap IDs of the sound track.
func (track *SoundTrack) OsuBeatmaps() []string {
return FilterIDTags(track.Tags, "osu-beatmap")
}
// EtternaBeatmaps returns all Etterna song IDs of the sound track.
func (track *SoundTrack) EtternaBeatmaps() []string {
return FilterIDTags(track.Tags, "etterna")
}
// MainAnime ... // MainAnime ...
func (track *SoundTrack) MainAnime() *Anime { func (track *SoundTrack) MainAnime() *Anime {
allAnime := track.Anime() allAnime := track.Anime()

View File

@ -5,18 +5,14 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strconv"
"strings" "strings"
"sync" "sync"
"time" "time"
"github.com/aerogo/aero/event" "github.com/aerogo/aero/event"
"github.com/aerogo/http/client" "github.com/aerogo/http/client"
"github.com/animenotifier/ffxiv"
"github.com/animenotifier/notify.moe/arn/autocorrect" "github.com/animenotifier/notify.moe/arn/autocorrect"
"github.com/animenotifier/notify.moe/arn/validate" "github.com/animenotifier/notify.moe/arn/validate"
"github.com/animenotifier/osu"
"github.com/animenotifier/overwatch"
gravatar "github.com/ungerik/go-gravatar" gravatar "github.com/ungerik/go-gravatar"
) )
@ -514,70 +510,3 @@ func (user *User) TypeName() string {
func (user *User) Self() Loggable { func (user *User) Self() Loggable {
return user return user
} }
// RefreshOsuInfo refreshes a user's Osu information.
func (user *User) RefreshOsuInfo() error {
if user.Accounts.Osu.Nick == "" {
return nil
}
osu, err := osu.GetUser(user.Accounts.Osu.Nick)
if err != nil {
return err
}
user.Accounts.Osu.PP, _ = strconv.ParseFloat(osu.PPRaw, 64)
user.Accounts.Osu.Level, _ = strconv.ParseFloat(osu.Level, 64)
user.Accounts.Osu.Accuracy, _ = strconv.ParseFloat(osu.Accuracy, 64)
return nil
}
// RefreshFFXIVInfo refreshes a user's FFXIV information.
func (user *User) RefreshFFXIVInfo() error {
if user.Accounts.FinalFantasyXIV.Nick == "" || user.Accounts.FinalFantasyXIV.Server == "" {
return nil
}
characterID, err := ffxiv.GetCharacterID(user.Accounts.FinalFantasyXIV.Nick, user.Accounts.FinalFantasyXIV.Server)
if err != nil {
return err
}
character, err := ffxiv.GetCharacter(characterID)
if err != nil {
return err
}
user.Accounts.FinalFantasyXIV.Class = character.Class
user.Accounts.FinalFantasyXIV.Level = character.Level
user.Accounts.FinalFantasyXIV.ItemLevel = character.ItemLevel
return nil
}
// RefreshOverwatchInfo refreshes a user's Overwatch information.
func (user *User) RefreshOverwatchInfo() error {
if user.Accounts.Overwatch.BattleTag == "" {
return nil
}
stats, err := overwatch.GetPlayerStats(user.Accounts.Overwatch.BattleTag)
if err != nil {
return err
}
skillRating, tier := stats.HighestSkillRating()
// Only show career highest skill rating
if skillRating > user.Accounts.Overwatch.SkillRating {
user.Accounts.Overwatch.SkillRating = skillRating
user.Accounts.Overwatch.Tier = tier
}
return nil
}

View File

@ -11,7 +11,6 @@ import (
"github.com/aerogo/aero" "github.com/aerogo/aero"
"github.com/aerogo/api" "github.com/aerogo/api"
"github.com/aerogo/http/client" "github.com/aerogo/http/client"
"github.com/akyoto/color"
"github.com/animenotifier/notify.moe/arn/autocorrect" "github.com/animenotifier/notify.moe/arn/autocorrect"
) )
@ -127,54 +126,6 @@ func (user *User) Edit(ctx aero.Context, key string, value reflect.Value, newVal
user.Accounts.Discord.Verified = false user.Accounts.Discord.Verified = false
} }
return true, nil
case "Accounts.Overwatch.BattleTag":
newBattleTag := newValue.String()
value.SetString(newBattleTag)
if newBattleTag == "" {
user.Accounts.Overwatch.SkillRating = 0
user.Accounts.Overwatch.Tier = ""
} else {
// Refresh Overwatch info if the battletag changed
go func() {
err := user.RefreshOverwatchInfo()
if err != nil {
color.Red("Error refreshing Overwatch info of user '%s' with Overwatch battle tag '%s': %v", user.Nick, newBattleTag, err)
return
}
color.Green("Refreshed Overwatch info of user '%s' with Overwatch battle tag '%s': %v", user.Nick, newBattleTag, user.Accounts.Overwatch.SkillRating)
user.Save()
}()
}
return true, nil
case "Accounts.FinalFantasyXIV.Nick", "Accounts.FinalFantasyXIV.Server":
newValue := newValue.String()
value.SetString(newValue)
if newValue == "" {
user.Accounts.FinalFantasyXIV.Class = ""
user.Accounts.FinalFantasyXIV.Level = 0
user.Accounts.FinalFantasyXIV.ItemLevel = 0
} else if user.Accounts.FinalFantasyXIV.Nick != "" && user.Accounts.FinalFantasyXIV.Server != "" {
// Refresh FinalFantasyXIV info if the name or server changed
go func() {
err := user.RefreshFFXIVInfo()
if err != nil {
color.Red("Error refreshing FinalFantasy XIV info of user '%s' with nick '%s' on server '%s': %v", user.Nick, user.Accounts.FinalFantasyXIV.Nick, user.Accounts.FinalFantasyXIV.Server, err)
return
}
user.Save()
}()
}
return true, nil return true, nil
} }
@ -183,28 +134,6 @@ func (user *User) Edit(ctx aero.Context, key string, value reflect.Value, newVal
newNick := newValue.String() newNick := newValue.String()
newNick = autocorrect.AccountNick(newNick) newNick = autocorrect.AccountNick(newNick)
value.SetString(newNick) value.SetString(newNick)
// Refresh osu info if the name changed
if key == "Accounts.Osu.Nick" {
if newNick == "" {
user.Accounts.Osu.PP = 0
user.Accounts.Osu.Level = 0
user.Accounts.Osu.Accuracy = 0
} else {
go func() {
err := user.RefreshOsuInfo()
if err != nil {
color.Red("Error refreshing osu info of user '%s' with osu nick '%s': %v", user.Nick, newNick, err)
return
}
color.Green("Refreshed osu info of user '%s' with osu nick '%s': %v", user.Nick, newNick, user.Accounts.Osu.PP)
user.Save()
}()
}
}
return true, nil return true, nil
} }

View File

@ -1,78 +1,5 @@
package arn package arn
// Register a list of gaming servers.
func init() {
DataLists["ffxiv-servers"] = []*Option{
{"", ""},
{"Adamantoise", "Adamantoise"},
{"Aegis", "Aegis"},
{"Alexander", "Alexander"},
{"Anima", "Anima"},
{"Asura", "Asura"},
{"Atomos", "Atomos"},
{"Bahamut", "Bahamut"},
{"Balmung", "Balmung"},
{"Behemoth", "Behemoth"},
{"Belias", "Belias"},
{"Brynhildr", "Brynhildr"},
{"Cactuar", "Cactuar"},
{"Carbuncle", "Carbuncle"},
{"Cerberus", "Cerberus"},
{"Chocobo", "Chocobo"},
{"Coeurl", "Coeurl"},
{"Diabolos", "Diabolos"},
{"Durandal", "Durandal"},
{"Excalibur", "Excalibur"},
{"Exodus", "Exodus"},
{"Faerie", "Faerie"},
{"Famfrit", "Famfrit"},
{"Fenrir", "Fenrir"},
{"Garuda", "Garuda"},
{"Gilgamesh", "Gilgamesh"},
{"Goblin", "Goblin"},
{"Gungnir", "Gungnir"},
{"Hades", "Hades"},
{"Hyperion", "Hyperion"},
{"Ifrit", "Ifrit"},
{"Ixion", "Ixion"},
{"Jenova", "Jenova"},
{"Kujata", "Kujata"},
{"Lamia", "Lamia"},
{"Leviathan", "Leviathan"},
{"Lich", "Lich"},
{"Louisoix", "Louisoix"},
{"Malboro", "Malboro"},
{"Mandragora", "Mandragora"},
{"Masamune", "Masamune"},
{"Mateus", "Mateus"},
{"Midgardsormr", "Midgardsormr"},
{"Moogle", "Moogle"},
{"Odin", "Odin"},
{"Omega", "Omega"},
{"Pandaemonium", "Pandaemonium"},
{"Phoenix", "Phoenix"},
{"Ragnarok", "Ragnarok"},
{"Ramuh", "Ramuh"},
{"Ridill", "Ridill"},
{"Sargatanas", "Sargatanas"},
{"Shinryu", "Shinryu"},
{"Shiva", "Shiva"},
{"Siren", "Siren"},
{"Tiamat", "Tiamat"},
{"Titan", "Titan"},
{"Tonberry", "Tonberry"},
{"Typhon", "Typhon"},
{"Ultima", "Ultima"},
{"Ultros", "Ultros"},
{"Unicorn", "Unicorn"},
{"Valefor", "Valefor"},
{"Yojimbo", "Yojimbo"},
{"Zalera", "Zalera"},
{"Zeromus", "Zeromus"},
{"Zodiark", "Zodiark"},
}
}
// UserAccounts represents a user's accounts on external services. // UserAccounts represents a user's accounts on external services.
type UserAccounts struct { type UserAccounts struct {
Facebook struct { Facebook struct {
@ -93,27 +20,6 @@ type UserAccounts struct {
Verified bool `json:"verified"` Verified bool `json:"verified"`
} `json:"discord"` } `json:"discord"`
Osu struct {
Nick string `json:"nick" editable:"true"`
PP float64 `json:"pp"`
Accuracy float64 `json:"accuracy"`
Level float64 `json:"level"`
} `json:"osu"`
Overwatch struct {
BattleTag string `json:"battleTag" editable:"true"`
SkillRating int `json:"skillRating"`
Tier string `json:"tier"`
} `json:"overwatch"`
FinalFantasyXIV struct {
Nick string `json:"nick" editable:"true"`
Server string `json:"server" editable:"true" datalist:"ffxiv-servers"`
Class string `json:"class"`
Level int `json:"level"`
ItemLevel int `json:"itemLevel"`
} `json:"ffxiv"`
AniList struct { AniList struct {
Nick string `json:"nick" editable:"true"` Nick string `json:"nick" editable:"true"`
} `json:"anilist"` } `json:"anilist"`

View File

@ -31,9 +31,7 @@ In the past it was, but not anymore. We're growing bigger by establishing a data
* Quotes * Quotes
* Companies * Companies
* Detailed anime rating system * Detailed anime rating system
* [twist.moe](https://twist.moe) integration
* [anilist.co](https://anilist.co/), [myanimelist.net](https://myanimelist.net/) and [kitsu.io](https://kitsu.io/) import * [anilist.co](https://anilist.co/), [myanimelist.net](https://myanimelist.net/) and [kitsu.io](https://kitsu.io/) import
* [osu](https://osu.ppy.sh/) ranking view
* [Gravatar](https://gravatar.com) support * [Gravatar](https://gravatar.com) support
## Can I follow the project on social media? ## Can I follow the project on social media?
@ -245,4 +243,4 @@ Sure, the setup to start contributing is not that hard. Try to get in contact wi
## Can I apply to be a data mod / editor? ## Can I apply to be a data mod / editor?
Sure, just contact me on Discord if you want to help out with the database. Sure, just contact me on Discord if you want to help out with the database.

3
go.mod
View File

@ -31,12 +31,9 @@ require (
github.com/akyoto/stringutils v0.3.1 github.com/akyoto/stringutils v0.3.1
github.com/akyoto/webpush-go v0.1.2 github.com/akyoto/webpush-go v0.1.2
github.com/animenotifier/anilist v0.2.6 github.com/animenotifier/anilist v0.2.6
github.com/animenotifier/ffxiv v0.2.2
github.com/animenotifier/japanese v0.2.5 github.com/animenotifier/japanese v0.2.5
github.com/animenotifier/kitsu v0.2.4 github.com/animenotifier/kitsu v0.2.4
github.com/animenotifier/mal v0.2.5 github.com/animenotifier/mal v0.2.5
github.com/animenotifier/osu v0.1.2
github.com/animenotifier/overwatch v0.1.3
github.com/animenotifier/shoboi v0.2.4 github.com/animenotifier/shoboi v0.2.4
github.com/animenotifier/twist v0.2.6 github.com/animenotifier/twist v0.2.6
github.com/bwmarrin/discordgo v0.22.0 github.com/bwmarrin/discordgo v0.22.0

6
go.sum
View File

@ -154,18 +154,12 @@ github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x0
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/animenotifier/anilist v0.2.6 h1:L1M7fcgy+gAShscnHucz+Jn3nM1hOQKWZxuyhLatBBo= github.com/animenotifier/anilist v0.2.6 h1:L1M7fcgy+gAShscnHucz+Jn3nM1hOQKWZxuyhLatBBo=
github.com/animenotifier/anilist v0.2.6/go.mod h1:fzOQXacU6rHnVoLFZaercp26BwNZDWkB6MocbNst5mY= github.com/animenotifier/anilist v0.2.6/go.mod h1:fzOQXacU6rHnVoLFZaercp26BwNZDWkB6MocbNst5mY=
github.com/animenotifier/ffxiv v0.2.2 h1:pW0TRqgjqNbZ8K8UskGWiTP43GdLD6hlzdfmxGdjsDk=
github.com/animenotifier/ffxiv v0.2.2/go.mod h1:JdnHHGD9W6QLdZWf38fw1jIqDRemr5dthlr5RKdmipE=
github.com/animenotifier/japanese v0.2.5 h1:3crv70AzmrTiJCI6SG9rUeFS2T3FXdxKwvRjjUa/74g= github.com/animenotifier/japanese v0.2.5 h1:3crv70AzmrTiJCI6SG9rUeFS2T3FXdxKwvRjjUa/74g=
github.com/animenotifier/japanese v0.2.5/go.mod h1:Xmhi5U+JbRuqmHzFB1zTMfA3SM35hKmzC0Z2J2q8SH0= github.com/animenotifier/japanese v0.2.5/go.mod h1:Xmhi5U+JbRuqmHzFB1zTMfA3SM35hKmzC0Z2J2q8SH0=
github.com/animenotifier/kitsu v0.2.4 h1:YFVUR0EPSbSljjgEWtf4Hz72cCFgGyxOpjPc+64EsWA= github.com/animenotifier/kitsu v0.2.4 h1:YFVUR0EPSbSljjgEWtf4Hz72cCFgGyxOpjPc+64EsWA=
github.com/animenotifier/kitsu v0.2.4/go.mod h1:9ymFP+JgXlIYJ+hvaZMut9M4jHXdteYG+7/dk4XggQY= github.com/animenotifier/kitsu v0.2.4/go.mod h1:9ymFP+JgXlIYJ+hvaZMut9M4jHXdteYG+7/dk4XggQY=
github.com/animenotifier/mal v0.2.5 h1:/Op5CCSlvLUIcUo5NvmuuL76Cgv39hemT5k/VF8+4EA= github.com/animenotifier/mal v0.2.5 h1:/Op5CCSlvLUIcUo5NvmuuL76Cgv39hemT5k/VF8+4EA=
github.com/animenotifier/mal v0.2.5/go.mod h1:M0KDAALEJ/hEqOxWNkdb4UuCZcnBc+jsYI/MEyh8KIQ= github.com/animenotifier/mal v0.2.5/go.mod h1:M0KDAALEJ/hEqOxWNkdb4UuCZcnBc+jsYI/MEyh8KIQ=
github.com/animenotifier/osu v0.1.2 h1:TJe5JzxCjZUGXfEkna+BlwK7twF92sD7UASIup/UaEQ=
github.com/animenotifier/osu v0.1.2/go.mod h1:QzxS8BM8UQ/7IJgtIuMAUZMMtAO2wqv7TGq+pe7lGDs=
github.com/animenotifier/overwatch v0.1.3 h1:m6owBEba2WRImY3dtj8Oo678+j29lnoRdctvBIXIvLw=
github.com/animenotifier/overwatch v0.1.3/go.mod h1:Y5NI0Y4+c7vTCwTpqgldSqQqyA59Cx8uMNwsc3ZVqxk=
github.com/animenotifier/shoboi v0.2.4 h1:eM9R/kQJgQzvcTSgxSFCpFyp8wqRxUXUk69cLd73gwM= github.com/animenotifier/shoboi v0.2.4 h1:eM9R/kQJgQzvcTSgxSFCpFyp8wqRxUXUk69cLd73gwM=
github.com/animenotifier/shoboi v0.2.4/go.mod h1:bWC3/vIc8NR1mvflm/HEH79rIq+AZMoRnWqLN2NKtBM= github.com/animenotifier/shoboi v0.2.4/go.mod h1:bWC3/vIc8NR1mvflm/HEH79rIq+AZMoRnWqLN2NKtBM=
github.com/animenotifier/twist v0.2.6 h1:CSrpScSwLTjR37kCFwAzIe84sA47fXaRHL3qGKCE9wQ= github.com/animenotifier/twist v0.2.6 h1:CSrpScSwLTjR37kCFwAzIe84sA47fXaRHL3qGKCE9wQ=

View File

@ -1,33 +0,0 @@
package main
import (
"fmt"
"time"
"github.com/akyoto/color"
"github.com/animenotifier/notify.moe/arn"
"github.com/animenotifier/notify.moe/arn/stringutils"
)
var tickerFFXIV = time.NewTicker(1100 * time.Millisecond)
func ffxiv(user *arn.User) {
fmt.Println("[FFXIV]", user.Nick, user.Accounts.FinalFantasyXIV.Nick, user.Accounts.FinalFantasyXIV.Server)
// Fetch new info
err := user.RefreshFFXIVInfo()
if err != nil {
color.Red(err.Error())
return
}
// Log it
stringutils.PrettyPrint(user.Accounts.FinalFantasyXIV)
// Save in database
user.Save()
// Wait for rate limiter
<-tickerFFXIV.C
}

View File

@ -1,33 +0,0 @@
package main
import (
"fmt"
"time"
"github.com/akyoto/color"
"github.com/animenotifier/notify.moe/arn"
"github.com/animenotifier/notify.moe/arn/stringutils"
)
var tickerOsu = time.NewTicker(500 * time.Millisecond)
func osu(user *arn.User) {
fmt.Println("[Osu]", user.Nick, user.Accounts.Osu.Nick)
// Fetch new info
err := user.RefreshOsuInfo()
if err != nil {
color.Red(err.Error())
return
}
// Log it
stringutils.PrettyPrint(user.Accounts.Osu)
// Save in database
user.Save()
// Wait for rate limiter
<-tickerOsu.C
}

View File

@ -1,33 +0,0 @@
package main
import (
"fmt"
"time"
"github.com/akyoto/color"
"github.com/animenotifier/notify.moe/arn"
"github.com/animenotifier/notify.moe/arn/stringutils"
)
var tickerOW = time.NewTicker(1100 * time.Millisecond)
func overwatch(user *arn.User) {
fmt.Println("[Overwatch]", user.Nick, user.Accounts.Overwatch.BattleTag)
// Fetch new info
err := user.RefreshOverwatchInfo()
if err != nil {
color.Red(err.Error())
return
}
// Log it
stringutils.PrettyPrint(user.Accounts.Overwatch)
// Save in database
user.Save()
// Wait for rate limiter
<-tickerOW.C
}

View File

@ -1,27 +0,0 @@
package main
import (
"github.com/akyoto/color"
"github.com/animenotifier/notify.moe/arn"
)
func main() {
color.Yellow("Refreshing game information")
defer color.Green("Finished.")
defer arn.Node.Close()
for user := range arn.StreamUsers() {
if user.Accounts.Osu.Nick != "" {
osu(user)
}
if user.Accounts.Overwatch.BattleTag != "" {
overwatch(user)
}
if user.Accounts.FinalFantasyXIV.Nick != "" && user.Accounts.FinalFantasyXIV.Server != "" {
ffxiv(user)
}
}
}

View File

@ -12,9 +12,6 @@ func Register(app *aero.Application) {
page.Get(app, "/users", users.Active) page.Get(app, "/users", users.Active)
page.Get(app, "/users/map", users.Map) page.Get(app, "/users/map", users.Map)
page.Get(app, "/users/noavatar", users.ActiveNoAvatar) page.Get(app, "/users/noavatar", users.ActiveNoAvatar)
page.Get(app, "/users/games/osu", users.Osu)
page.Get(app, "/users/games/overwatch", users.Overwatch)
page.Get(app, "/users/games/ffxiv", users.FFXIV)
page.Get(app, "/users/staff", users.Staff) page.Get(app, "/users/staff", users.Staff)
page.Get(app, "/users/pro", users.Pro) page.Get(app, "/users/pro", users.Pro)
page.Get(app, "/users/editors", users.Editors) page.Get(app, "/users/editors", users.Editors)

View File

@ -198,18 +198,6 @@ component ProfileTags(viewUser *arn.User, animeList *arn.AnimeList, user *arn.Us
if viewUser.Website != "" if viewUser.Website != ""
a.profile-tag.tip.mountable.never-unmount.show-more(href=viewUser.WebsiteURL(), target="_blank", rel="noopener", aria-label=viewUser.WebsiteShortURL(), data-mountable-type="header") a.profile-tag.tip.mountable.never-unmount.show-more(href=viewUser.WebsiteURL(), target="_blank", rel="noopener", aria-label=viewUser.WebsiteShortURL(), data-mountable-type="header")
RawIcon("globe") RawIcon("globe")
if viewUser.Accounts.Osu.Nick != "" && viewUser.Accounts.Osu.PP >= 100
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://osu.ppy.sh/u/" + viewUser.Accounts.Osu.Nick, aria-label=fmt.Sprintf("osu! | %.0f pp | Level %.0f | Accuracy: %.1f%%", viewUser.Accounts.Osu.PP, viewUser.Accounts.Osu.Level, viewUser.Accounts.Osu.Accuracy), target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("trophy")
if viewUser.Accounts.Overwatch.BattleTag != "" && viewUser.Accounts.Overwatch.SkillRating >= 1000
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://playoverwatch.com/en-us/career/pc/" + strings.Replace(viewUser.Accounts.Overwatch.BattleTag, "#", "-", 1), aria-label=fmt.Sprintf("Overwatch | %d SR | %s", viewUser.Accounts.Overwatch.SkillRating, stringutils.Capitalize(viewUser.Accounts.Overwatch.Tier)), target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("overwatch")
if viewUser.Accounts.FinalFantasyXIV.Nick != "" && viewUser.Accounts.FinalFantasyXIV.Class != ""
.profile-tag.tip.mountable.never-unmount.show-more(aria-label=fmt.Sprintf("Final Fantasy XIV | %s | Level %d | IL %d", viewUser.Accounts.FinalFantasyXIV.Class, viewUser.Accounts.FinalFantasyXIV.Level, viewUser.Accounts.FinalFantasyXIV.ItemLevel), data-mountable-type="header")
RawIcon("gamepad")
if viewUser.Accounts.Discord.Nick != "" && viewUser.Accounts.Discord.Verified if viewUser.Accounts.Discord.Nick != "" && viewUser.Accounts.Discord.Verified
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://discord.gg/0kimAmMCeXGXuzNF", aria-label=fmt.Sprintf("Discord | %s", viewUser.Accounts.Discord.Nick), data-mountable-type="header") a.profile-tag.tip.mountable.never-unmount.show-more(href="https://discord.gg/0kimAmMCeXGXuzNF", aria-label=fmt.Sprintf("Discord | %s", viewUser.Accounts.Discord.Nick), data-mountable-type="header")
@ -231,4 +219,4 @@ component ProfileTags(viewUser *arn.User, animeList *arn.AnimeList, user *arn.Us
if user != nil && user.Role == "admin" if user != nil && user.Role == "admin"
a.profile-tag.tip.mountable.never-unmount.show-more(href="/api/user/" + viewUser.ID, aria-label="API", target="_blank", rel="noopener", data-mountable-type="header") a.profile-tag.tip.mountable.never-unmount.show-more(href="/api/user/" + viewUser.ID, aria-label="API", target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("search-plus") RawIcon("search-plus")

View File

@ -13,16 +13,6 @@ component SettingsAccounts(user *arn.User)
InputText("Accounts.Kitsu.Nick", user.Accounts.Kitsu.Nick, "Kitsu", "Your username on kitsu.io", 30) InputText("Accounts.Kitsu.Nick", user.Accounts.Kitsu.Nick, "Kitsu", "Your username on kitsu.io", 30)
InputText("Accounts.MyAnimeList.Nick", user.Accounts.MyAnimeList.Nick, "MyAnimeList", "Your username on myanimelist.net", 30) InputText("Accounts.MyAnimeList.Nick", user.Accounts.MyAnimeList.Nick, "MyAnimeList", "Your username on myanimelist.net", 30)
InputText("Accounts.Discord.Nick", user.Accounts.Discord.Nick, "Discord", "Your username on Discord", 30) InputText("Accounts.Discord.Nick", user.Accounts.Discord.Nick, "Discord", "Your username on Discord", 30)
.widget.mountable(data-api="/api/user/" + user.ID)
h3.widget-title
Icon("gamepad")
span Games
InputText("Accounts.FinalFantasyXIV.Nick", user.Accounts.FinalFantasyXIV.Nick, "Final Fantasy XIV", "Your character name on FFXIV", 30)
InputSelection("Accounts.FinalFantasyXIV.Server", user.Accounts.FinalFantasyXIV.Server, "Final Fantasy XIV - World", "Your server/world on FFXIV", arn.DataLists["ffxiv-servers"])
InputText("Accounts.Osu.Nick", user.Accounts.Osu.Nick, "Osu", "Your username on osu.ppy.sh", 30)
InputText("Accounts.Overwatch.BattleTag", user.Accounts.Overwatch.BattleTag, "Overwatch", "Your battletag on Overwatch", 30)
.widget.mountable .widget.mountable
h3.widget-title h3.widget-title
@ -80,10 +70,3 @@ component SettingsAccounts(user *arn.User)
a.button(href="/api/animelist/" + user.ID, target="_blank") a.button(href="/api/animelist/" + user.ID, target="_blank")
Icon("upload") Icon("upload")
span Export anime list as JSON span Export anime list as JSON
.widget.mountable
h3.widget-title
Icon("refresh")
span Sync
footer.footer Reserved for upcoming features.

View File

@ -44,20 +44,7 @@ component SoundTrackPage(track *arn.SoundTrack, relatedTracks []*arn.SoundTrack,
each relatedTrack in relatedTracks each relatedTrack in relatedTracks
li li
a(href=relatedTrack.Link())= relatedTrack.TitleByUser(user) a(href=relatedTrack.Link())= relatedTrack.TitleByUser(user)
//- TODO: This is quite ineffective, performance-wise
if len(track.OsuBeatmaps()) > 0 || len(track.EtternaBeatmaps()) > 0
.widget.mountable
h3.widget-title Beatmaps
ul.beatmaps
for index, beatmap := range track.OsuBeatmaps()
li
a.beatmap(href="https://osu.ppy.sh/s/" + beatmap, target="_blank")= "Osu Beatmap #" + strconv.Itoa(index + 1)
for index, beatmap := range track.EtternaBeatmaps()
li
a.beatmap(href="https://etternaonline.com/song/view/" + beatmap, target="_blank")= "Etterna Beatmap #" + strconv.Itoa(index + 1)
.widget.mountable .widget.mountable
h3.widget-title Tags h3.widget-title Tags

View File

@ -1,8 +0,0 @@
component FinalFantasyXIVRankingList(users []*arn.User, url string)
h1.page-title Final Fantasy XIV ranking list
UsersTabs(url)
.user-cards
each user in users
UserCard(user, fmt.Sprintf("%s (iLvl %d)", user.Accounts.FinalFantasyXIV.Class, user.Accounts.FinalFantasyXIV.ItemLevel))

View File

@ -1,8 +0,0 @@
component OsuRankingList(users []*arn.User, url string)
h1.page-title osu! ranking list
UsersTabs(url)
.user-cards
each user in users
UserCard(user, fmt.Sprintf("%s pp (%.1f%%)", humanize.Comma(int64(user.Accounts.Osu.PP + 0.5)), user.Accounts.Osu.Accuracy))

View File

@ -1,8 +0,0 @@
component OverwatchRankingList(users []*arn.User, url string)
h1.page-title Overwatch ranking list
UsersTabs(url)
.user-cards
each user in users
UserCard(user, fmt.Sprintf("%s (%d SR)", strings.Title(user.Accounts.Overwatch.Tier), user.Accounts.Overwatch.SkillRating))

View File

@ -86,48 +86,6 @@ func ActiveNoAvatar(ctx aero.Context) error {
return ctx.HTML(components.Users(users, followCount, ctx.Path())) return ctx.HTML(components.Users(users, followCount, ctx.Path()))
} }
// Osu ...
func Osu(ctx aero.Context) error {
users := arn.FilterUsers(func(user *arn.User) bool {
return user.HasAvatar() && user.HasNick() && user.IsActive() && user.Accounts.Osu.PP > 0
})
// Sort by pp
sort.Slice(users, func(i, j int) bool {
return users[i].Accounts.Osu.PP > users[j].Accounts.Osu.PP
})
return ctx.HTML(components.OsuRankingList(users, ctx.Path()))
}
// Overwatch ...
func Overwatch(ctx aero.Context) error {
users := arn.FilterUsers(func(user *arn.User) bool {
return user.HasAvatar() && user.HasNick() && user.IsActive() && user.Accounts.Overwatch.SkillRating > 0
})
// Sort by Skill Ratings
sort.Slice(users, func(i, j int) bool {
return users[i].Accounts.Overwatch.SkillRating > users[j].Accounts.Overwatch.SkillRating
})
return ctx.HTML(components.OverwatchRankingList(users, ctx.Path()))
}
// FFXIV ...
func FFXIV(ctx aero.Context) error {
users := arn.FilterUsers(func(user *arn.User) bool {
return user.HasAvatar() && user.HasNick() && user.IsActive() && user.Accounts.FinalFantasyXIV.ItemLevel > 0
})
// Sort by item level
sort.Slice(users, func(i, j int) bool {
return users[i].Accounts.FinalFantasyXIV.ItemLevel > users[j].Accounts.FinalFantasyXIV.ItemLevel
})
return ctx.HTML(components.FinalFantasyXIVRankingList(users, ctx.Path()))
}
// ByCountry ... // ByCountry ...
func ByCountry(ctx aero.Context) error { func ByCountry(ctx aero.Context) error {
countryName := ctx.Get("country") countryName := ctx.Get("country")

View File

@ -48,14 +48,7 @@ component StaffRecruitment
component UsersTabs(url string) component UsersTabs(url string)
.tabs .tabs
Tab("Active", "users", "/users") Tab("Active", "users", "/users")
Tab("Games", "gamepad", "/users/games/osu")
Tab("Editors", "pencil", "/users/editors") Tab("Editors", "pencil", "/users/editors")
Tab("Supporters", "heart", "/users/pro") Tab("Supporters", "heart", "/users/pro")
Tab("Staff", "user-secret", "/users/staff") Tab("Staff", "user-secret", "/users/staff")
//- Tab("Map", "map", "/users/map") //- Tab("Map", "map", "/users/map")
if strings.Contains(url, "/users/games")
.tabs
Tab("Osu", "gamepad", "/users/games/osu")
Tab("Overwatch", "overwatch", "/users/games/overwatch")
Tab("FFXIV", "gamepad", "/users/games/ffxiv")