added program startup

This commit is contained in:
Данил 2022-09-25 11:10:27 +03:00
parent 16582ce658
commit eb25c6595f
2 changed files with 15 additions and 16 deletions

10
main.go
View file

@ -6,7 +6,6 @@ import (
"github.com/Redume/EveryNasa/api/controllers" "github.com/Redume/EveryNasa/api/controllers"
"github.com/Redume/EveryNasa/functions" "github.com/Redume/EveryNasa/functions"
"github.com/Redume/EveryNasa/web/pages" "github.com/Redume/EveryNasa/web/pages"
"github.com/getlantern/systray" "github.com/getlantern/systray"
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )
@ -36,19 +35,18 @@ func main() {
router.HandleFunc("/api/get/version", controllers.Version).Methods("GET") router.HandleFunc("/api/get/version", controllers.Version).Methods("GET")
router.HandleFunc("/api/update/settings", controllers.SettingsUpdate).Methods("POST") router.HandleFunc("/api/update/settings", controllers.SettingsUpdate).Methods("POST")
router.HandleFunc("/api/update/wallpaper", controllers.WallpaperUpdate).Methods("POST") router.HandleFunc("/api/update/wallpaper", controllers.WallpaperUpdate).Methods("POST")
router.HandleFunc("/api/update/add/startapp", controllers.AddStartApp).Methods("POST") router.HandleFunc("/api/update/set/startup", controllers.SetStartup).Methods("POST")
router.HandleFunc("/api/update/del/startapp", controllers.RemoveStartApp).Methods("POST") router.HandleFunc("/api/update/del/startup", controllers.RemoveStartup).Methods("POST")
go func() { go func() {
err := http.ListenAndServe(":4662", nil) err := http.ListenAndServe(":4662", nil)
if err != nil { if err != nil {
panic(err) functions.Logger(err.Error())
} }
}() }()
err := http.ListenAndServe(":8080", router) err := http.ListenAndServe(":8080", router)
if err != nil { if err != nil {
panic(err) functions.Logger(err.Error())
} }
} }

View file

@ -34,20 +34,20 @@
<h1 id="title">Application Settings</h1> <h1 id="title">Application Settings</h1>
<div class="container"> <div class="container">
<header class="header-row"> <header class="header-row">
<div class="settings">
<p class="title"><strong>Add a program to the startup</strong></p>
<p class="desc">EverNasa will automatically start when you log in.</p>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="startupSwitch">
<label class="form-check-label" for="startupText" id="startupText">Off</label>
</div>
</div>
<div class="settings"> <div class="settings">
<p class="title"><strong>Auto-change of desktop wallpaper</strong></p> <p class="title"><strong>Auto-change of desktop wallpaper</strong></p>
<p class="desc">EveryNasa will automatically change the desktop wallpaper at startup as well as every day</p> <p class="desc">EveryNasa will automatically change the desktop wallpaper at startup as well as every day</p>
<div class="form-check form-switch"> <div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="autosetWallpaperSwitch"> <input class="form-check-input" type="checkbox" role="switch" id="autosetWallpaperSwitch">
<label class="form-check-label" for="autorunText" id="autosetWallpaperText">Off</label> <label class="form-check-label" for="autosetWallpaperText" id="autosetWallpaperText">Off</label>
</div>
</div>
<div class="settings">
<p class="title"><strong>Add a program to the startup</strong></p>
<p class="desc">EverNasa will automatically start when you log in.</p>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="autorunSwitch">
<label class="form-check-label" for="autorunText" id="autorunText">Off</label>
</div> </div>
</div> </div>
</header> </header>
@ -64,6 +64,7 @@
</div> </div>
<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.min.js" integrity="sha384-7VPbUDkoPSGFnVtYi0QogXtr74QeVeeIs99Qfg5YCF+TidwNdjvaKZX19NZ/e6oz" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.min.js" integrity="sha384-7VPbUDkoPSGFnVtYi0QogXtr74QeVeeIs99Qfg5YCF+TidwNdjvaKZX19NZ/e6oz" crossorigin="anonymous"></script>
<script src="/static/scripts/switch.js"></script> <script src="/static/scripts/switch.js" type="application/javascript"></script>
<script src="/static/scripts/update.js" type="application/javascript"></script>
</body> </body>
</html> </html>