apt.go 811 B

123456789101112131415161718192021222324252627282930
  1. package main
  2. import (
  3. "net/http"
  4. apt "imuslab.com/arozos/mod/apt"
  5. prout "imuslab.com/arozos/mod/prouter"
  6. "imuslab.com/arozos/mod/utils"
  7. )
  8. func PackagManagerInit() {
  9. //Create a package manager
  10. packageManager = apt.NewPackageManager(*allow_package_autoInstall)
  11. systemWideLogger.PrintAndLog("APT", "Package Manager Initiated", nil)
  12. //Create a System Setting handler
  13. //aka who can access System Setting can see contents about packages
  14. router := prout.NewModuleRouter(prout.RouterOption{
  15. ModuleName: "System Setting",
  16. AdminOnly: false,
  17. UserHandler: userHandler,
  18. DeniedHandler: func(w http.ResponseWriter, r *http.Request) {
  19. utils.SendErrorResponse(w, "Permission Denied")
  20. },
  21. })
  22. //Handle package listing request
  23. router.HandleFunc("/system/apt/list", apt.HandlePackageListRequest)
  24. }