Added CallbackApp to better access backend.Backend from with in an App
Fixed issues with CORS not being able to do an OPTIONS request Fixed folders not being processed properly. Fixed some other issues.
This commit is contained in:
@@ -17,7 +17,7 @@ type SWBackend struct {
|
||||
db *mongo.Database
|
||||
}
|
||||
|
||||
func NewSWBackend(back *backend.Backend, db *mongo.Database) *SWBackend {
|
||||
func NewSWBackend(db *mongo.Database) *SWBackend {
|
||||
go func() {
|
||||
for range time.Tick(time.Hour) {
|
||||
log.Println("SWAssistant: Deleting expired profiles")
|
||||
@@ -29,8 +29,7 @@ func NewSWBackend(back *backend.Backend, db *mongo.Database) *SWBackend {
|
||||
}
|
||||
}()
|
||||
return &SWBackend{
|
||||
back: back,
|
||||
db: db,
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +45,10 @@ func (s *SWBackend) CrashTable() backend.CrashTable {
|
||||
return db.NewMongoCrashTable(s.db.Collection("crashes"), s.db.Collection("crashArchive"))
|
||||
}
|
||||
|
||||
func (s *SWBackend) AddBackend(b *backend.Backend) {
|
||||
s.back = b
|
||||
}
|
||||
|
||||
func (s *SWBackend) AddCrash(cr backend.IndividualCrash) bool {
|
||||
res := s.db.Collection("versions").FindOne(context.Background(), bson.M{"version": cr.Version})
|
||||
return res.Err() != mongo.ErrNoDocuments
|
||||
|
||||
Reference in New Issue
Block a user