feat(app): implement character login and destination setting for multiple characters
This commit introduces several key features: - **Multiple Character Support**: The application can now handle multiple logged-in EVE Online characters. - **List Characters**: A new function `ListCharacters` allows retrieving a list of all authenticated characters. - **Set Destination for All**: The `SetDestinationForAll` function enables setting a destination for all logged-in characters simultaneously. - **UI Updates**: The frontend has been updated to display logged-in characters and to allow setting destinations for all characters. - **Backend Refinements**: The ESI SSO logic has been improved to support refreshing tokens for multiple characters and to handle the new multi-character functionality. - **Dependency Updates**: Dependencies have been updated to their latest versions. chore: update go module dependencies
This commit is contained in:
28
app.go
28
app.go
@@ -97,3 +97,31 @@ func (a *App) SetDestinationByName(systemName string, clearOthers bool, addToBeg
|
||||
}
|
||||
return a.ssi.PostWaypoint(id, clearOthers, addToBeginning)
|
||||
}
|
||||
|
||||
// SetDestinationForAll resolves system name to ID and applies waypoint to all logged-in characters
|
||||
func (a *App) SetDestinationForAll(systemName string, clearOthers bool, addToBeginning bool) error {
|
||||
if a.ssi == nil {
|
||||
return errors.New("ESI not initialised")
|
||||
}
|
||||
id, err := a.ssi.ResolveSystemIDByName(a.ctx, systemName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return a.ssi.PostWaypointForAll(id, clearOthers, addToBeginning)
|
||||
}
|
||||
|
||||
// ListCharacters returns all characters stored in the token DB
|
||||
func (a *App) ListCharacters() ([]CharacterInfo, error) {
|
||||
if a.ssi == nil || a.ssi.db == nil {
|
||||
return nil, errors.New("ESI not initialised")
|
||||
}
|
||||
var tokens []ESIToken
|
||||
if err := a.ssi.db.Find(&tokens).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]CharacterInfo, 0, len(tokens))
|
||||
for _, t := range tokens {
|
||||
list = append(list, CharacterInfo{CharacterID: t.CharacterID, CharacterName: t.CharacterName})
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user