Added some MAL jobs to the UI
This commit is contained in:
parent
262b6018d1
commit
47045fc571
@ -18,6 +18,15 @@ var jobInfo = map[string]*utils.JobInfo{
|
|||||||
"refresh-osu": &utils.JobInfo{
|
"refresh-osu": &utils.JobInfo{
|
||||||
Name: "refresh-osu",
|
Name: "refresh-osu",
|
||||||
},
|
},
|
||||||
|
"mal-download": &utils.JobInfo{
|
||||||
|
Name: "mal-download",
|
||||||
|
},
|
||||||
|
"mal-parse": &utils.JobInfo{
|
||||||
|
Name: "mal-parse",
|
||||||
|
},
|
||||||
|
// "mal-sync": &utils.JobInfo{
|
||||||
|
// Name: "mal-sync",
|
||||||
|
// },
|
||||||
}
|
}
|
||||||
|
|
||||||
var jobLogs = []string{}
|
var jobLogs = []string{}
|
||||||
|
@ -2,6 +2,7 @@ package jobs
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
|
|
||||||
@ -9,8 +10,14 @@ import (
|
|||||||
"github.com/animenotifier/notify.moe/utils"
|
"github.com/animenotifier/notify.moe/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Only allow one job to be started at a time
|
||||||
|
var jobStartMutex sync.Mutex
|
||||||
|
|
||||||
// Start will start the specified background job.
|
// Start will start the specified background job.
|
||||||
func Start(ctx *aero.Context) string {
|
func Start(ctx *aero.Context) string {
|
||||||
|
jobStartMutex.Lock()
|
||||||
|
defer jobStartMutex.Unlock()
|
||||||
|
|
||||||
user := utils.GetUser(ctx)
|
user := utils.GetUser(ctx)
|
||||||
|
|
||||||
if user == nil || (user.Role != "editor" && user.Role != "admin") {
|
if user == nil || (user.Role != "editor" && user.Role != "admin") {
|
||||||
|
Loading…
Reference in New Issue
Block a user