mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
agent: .autoCheckUpdates
This commit is contained in:
committed by
Aiden McClelland
parent
d5d0ea3ade
commit
fcb807eb42
@@ -7,6 +7,7 @@
|
|||||||
/v0 ServerR GET PATCH
|
/v0 ServerR GET PATCH
|
||||||
|
|
||||||
/v0/name NameR PATCH
|
/v0/name NameR PATCH
|
||||||
|
/v0/autoCheckUpdates AutoCheckUpdatesR PATCH
|
||||||
|
|
||||||
/v0/welcome/#Version WelcomeR POST
|
/v0/welcome/#Version WelcomeR POST
|
||||||
/v0/specs SpecsR GET
|
/v0/specs SpecsR GET
|
||||||
|
|||||||
@@ -109,9 +109,24 @@ newtype NullablePatchReq = NullablePatchReq { mpatchValue :: Maybe Text } derivi
|
|||||||
instance FromJSON NullablePatchReq where
|
instance FromJSON NullablePatchReq where
|
||||||
parseJSON = withObject "Nullable Patch Request" $ \o -> NullablePatchReq <$> o .:? "value"
|
parseJSON = withObject "Nullable Patch Request" $ \o -> NullablePatchReq <$> o .:? "value"
|
||||||
|
|
||||||
|
newtype BoolPatchReq = BoolPatchReq { bpatchValue :: Bool } deriving (Eq, Show)
|
||||||
|
|
||||||
|
instance FromJSON BoolPatchReq where
|
||||||
|
parseJSON = withObject "Patch Request" $ \o -> BoolPatchReq <$> o .: "value"
|
||||||
|
|
||||||
patchNameR :: Handler ()
|
patchNameR :: Handler ()
|
||||||
patchNameR = patchFile serverNamePath
|
patchNameR = patchFile serverNamePath
|
||||||
|
|
||||||
|
patchAutoCheckUpdatesR :: Handler ()
|
||||||
|
patchAutoCheckUpdatesR = do
|
||||||
|
settings <- getsYesod appSettings
|
||||||
|
BoolPatchReq val <- requireCheckJsonBody
|
||||||
|
runM $
|
||||||
|
injectFilesystemBaseFromContext settings $
|
||||||
|
if val
|
||||||
|
then writeSystemPath autoCheckUpdatesPath ""
|
||||||
|
else deleteSystemPath autoCheckUpdatesPath
|
||||||
|
|
||||||
patchFile :: SystemPath -> Handler ()
|
patchFile :: SystemPath -> Handler ()
|
||||||
patchFile path = do
|
patchFile path = do
|
||||||
settings <- getsYesod appSettings
|
settings <- getsYesod appSettings
|
||||||
|
|||||||
@@ -188,6 +188,9 @@ agentTorHiddenServicePrivateKeyPath = agentTorHiddenServiceDirectory <> "/hs_ed2
|
|||||||
serverNamePath :: SystemPath
|
serverNamePath :: SystemPath
|
||||||
serverNamePath = "/root/agent/name.txt"
|
serverNamePath = "/root/agent/name.txt"
|
||||||
|
|
||||||
|
autoCheckUpdatesPath :: SystemPath
|
||||||
|
autoCheckUpdatesPath = "/root/agent/.autoCheckUpdates"
|
||||||
|
|
||||||
altRegistryUrlPath :: SystemPath
|
altRegistryUrlPath :: SystemPath
|
||||||
altRegistryUrlPath = "/root/agent/alt_registry_url.txt"
|
altRegistryUrlPath = "/root/agent/alt_registry_url.txt"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user