core: allow quoted strings (with spaces) in network interface of remote hosts (#3592)

This commit is contained in:
Evgeny Poberezkin 2023-12-28 10:06:49 +00:00 committed by GitHub
parent 07334b057d
commit b4dd6941d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -2385,7 +2385,7 @@ sealed class CC {
is CancelFile -> "/fcancel $fileId" is CancelFile -> "/fcancel $fileId"
is SetLocalDeviceName -> "/set device name $displayName" is SetLocalDeviceName -> "/set device name $displayName"
is ListRemoteHosts -> "/list remote hosts" is ListRemoteHosts -> "/list remote hosts"
is StartRemoteHost -> "/start remote host " + (if (remoteHostId == null) "new" else "$remoteHostId multicast=${onOff(multicast)}") + (if (address != null) " addr=${address.address} iface=${address.`interface`}" else "") + (if (port != null) " port=$port" else "") is StartRemoteHost -> "/start remote host " + (if (remoteHostId == null) "new" else "$remoteHostId multicast=${onOff(multicast)}") + (if (address != null) " addr=${address.address} iface=${json.encodeToString(address.`interface`)}" else "") + (if (port != null) " port=$port" else "")
is SwitchRemoteHost -> "/switch remote host " + if (remoteHostId == null) "local" else "$remoteHostId" is SwitchRemoteHost -> "/switch remote host " + if (remoteHostId == null) "local" else "$remoteHostId"
is StopRemoteHost -> "/stop remote host " + if (remoteHostKey == null) "new" else "$remoteHostKey" is StopRemoteHost -> "/stop remote host " + if (remoteHostKey == null) "new" else "$remoteHostKey"
is DeleteRemoteHost -> "/delete remote host $remoteHostId" is DeleteRemoteHost -> "/delete remote host $remoteHostId"

View File

@ -6543,7 +6543,7 @@ chatCommandP =
(pure Nothing) (pure Nothing)
srvCfgP = strP >>= \case AProtocolType p -> APSC p <$> (A.space *> jsonP) srvCfgP = strP >>= \case AProtocolType p -> APSC p <$> (A.space *> jsonP)
toServerCfg server = ServerCfg {server, preset = False, tested = Nothing, enabled = True} toServerCfg server = ServerCfg {server, preset = False, tested = Nothing, enabled = True}
rcCtrlAddressP = RCCtrlAddress <$> ("addr=" *> strP) <*> (" iface=" *> text1P) rcCtrlAddressP = RCCtrlAddress <$> ("addr=" *> strP) <*> (" iface=" *> (jsonP <|> text1P))
text1P = safeDecodeUtf8 <$> A.takeTill (== ' ') text1P = safeDecodeUtf8 <$> A.takeTill (== ' ')
char_ = optional . A.char char_ = optional . A.char

View File

@ -142,7 +142,7 @@ storedBindingsTest = testChat2 aliceProfile aliceDesktopProfile $ \mobile deskto
mobile ##> "/set device name Mobile" mobile ##> "/set device name Mobile"
mobile <## "ok" mobile <## "ok"
desktop ##> "/start remote host new addr=127.0.0.1 iface=lo port=52230" desktop ##> "/start remote host new addr=127.0.0.1 iface=\"lo\" port=52230"
desktop <##. "new remote host started on 127.0.0.1:52230" -- TODO: show ip? desktop <##. "new remote host started on 127.0.0.1:52230" -- TODO: show ip?
desktop <## "Remote session invitation:" desktop <## "Remote session invitation:"
inv <- getTermLine desktop inv <- getTermLine desktop