mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
Fix/insert admin (#144)
* change insert to do nothing on conflict * misc protocol updates
This commit is contained in:
@@ -35,7 +35,13 @@ NONE
|
|||||||
|
|
||||||
#### Query Params
|
#### Query Params
|
||||||
|
|
||||||
- (Required) "eos-version-compat": EmverRange specifying what versions of the OS that pack the packages are valid response items
|
- (Legacy) "eos-version-compat": EmverRange specifying what versions of the OS that pack the packages are valid response items
|
||||||
|
- (Required) "os.compat": EmverRange specifying what versions of the OS that pack the packages are valid response items
|
||||||
|
- (Required): "hardware.ram":
|
||||||
|
- (Required): "hardware.device":
|
||||||
|
- (Required): "hardware.arch":
|
||||||
|
- (Required): "os.arch":
|
||||||
|
- (Legacy): "arch":
|
||||||
- (Optional) "ids": json array of package ids
|
- (Optional) "ids": json array of package ids
|
||||||
- (Optional) "category": string representing
|
- (Optional) "category": string representing
|
||||||
- (Optional) "page": which page of the index you want (NOTE: starts at 1) (Default: 1)
|
- (Optional) "page": which page of the index you want (NOTE: starts at 1) (Default: 1)
|
||||||
@@ -63,7 +69,7 @@ NONE
|
|||||||
// name of dependency
|
// name of dependency
|
||||||
"title": "<STRING>",
|
"title": "<STRING>",
|
||||||
// icon of dependency
|
// icon of dependency
|
||||||
"icon": "<DATAURL>"
|
"icon": "<URL>"
|
||||||
},
|
},
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ import Network.HTTP.Types.Status (status401)
|
|||||||
import Yesod (getsYesod)
|
import Yesod (getsYesod)
|
||||||
import Settings (AppSettings(whitelist))
|
import Settings (AppSettings(whitelist))
|
||||||
import Network.HTTP.Types (status200)
|
import Network.HTTP.Types (status200)
|
||||||
import Database.Persist (insert_)
|
import Database.Persist (insert_, insertBy)
|
||||||
import Yesod (lookupPostParam)
|
import Yesod (lookupPostParam)
|
||||||
import Data.Maybe (isNothing)
|
import Data.Maybe (isNothing)
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ checkAdminAuthUpload pkgId = do
|
|||||||
else if authorized && newPkg
|
else if authorized && newPkg
|
||||||
-- if pkg is whitelisted and a new upload, add as authorized for this admin user
|
-- if pkg is whitelisted and a new upload, add as authorized for this admin user
|
||||||
then do
|
then do
|
||||||
runDB $ insert_ (AdminPkgs (AdminKey name) pkgId)
|
_ <- runDB $ insertBy (AdminPkgs (AdminKey name) pkgId)
|
||||||
pure name
|
pure name
|
||||||
else sendResponseText status401 "User not authorized to upload this package."
|
else sendResponseText status401 "User not authorized to upload this package."
|
||||||
else sendResponseText status401 "Package does not belong on this registry."
|
else sendResponseText status401 "Package does not belong on this registry."
|
||||||
|
|||||||
Reference in New Issue
Block a user