Added some MAL jobs to the UI

This commit is contained in:
2018-04-28 22:10:47 +02:00
parent 262b6018d1
commit 47045fc571
2 changed files with 16 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package jobs
import (
"net/http"
"sync"
"github.com/animenotifier/arn"
@ -9,8 +10,14 @@ import (
"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.
func Start(ctx *aero.Context) string {
jobStartMutex.Lock()
defer jobStartMutex.Unlock()
user := utils.GetUser(ctx)
if user == nil || (user.Role != "editor" && user.Role != "admin") {