This commit is contained in:
@@ -57,6 +57,28 @@ func One(gameID string) (Remote, error) {
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func All() ([]Remote, error) {
|
||||
d, err := os.ReadDir(filepath.Clean(datastorepath))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load datastore: %w", err)
|
||||
}
|
||||
|
||||
var res []Remote
|
||||
for _, g := range d {
|
||||
r, err := One(g.Name())
|
||||
if err != nil {
|
||||
if errors.Is(err, ErrNoRemote) {
|
||||
continue
|
||||
}
|
||||
return nil, fmt.Errorf("failed to load remote: %w", err)
|
||||
}
|
||||
|
||||
res = append(res, r)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func Set(gameID, url string) error {
|
||||
r := Remote{
|
||||
URL: url,
|
||||
|
||||
Reference in New Issue
Block a user