mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-06 01:13:57 +03:00
set wallpaper from api
This commit is contained in:
parent
5d09e64a26
commit
8adce860b7
1 changed files with 23 additions and 0 deletions
23
api/controllers/wallpaper.go
Normal file
23
api/controllers/wallpaper.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/Redume/EveryNasa/api/utils"
|
||||
"github.com/reujab/wallpaper"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var WallpaperUpdate = func(w http.ResponseWriter, r *http.Request) {
|
||||
var url string
|
||||
|
||||
url = r.FormValue("url")
|
||||
|
||||
if url == "" {
|
||||
utils.Respond(w, utils.Message(false, "URL is required"))
|
||||
return
|
||||
}
|
||||
|
||||
err := wallpaper.SetFromURL(url)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue