Verified Commit db903e2e authored by Camil Staps's avatar Camil Staps 🚀

Use base64 encoding in serializeForClient

parent 5e3648f8
Pipeline #27656 passed with stage
in 5 minutes and 9 seconds
......@@ -26,6 +26,6 @@ dynamicJSONDecode :: !JSONNode -> Maybe a
* WebAssembly interpreter. The values are serialized using GraphCopy after
* which the descriptors are replaced by the descriptors of the client.
* @param The expression to serialize.
* @result The serialized string.
* @result The serialized string in base64 encoding.
*/
serializeForClient :: f !*VSt -> *(!String, !*VSt)
serializeForClient :: a !*VSt -> *(!String, !*VSt)
......@@ -51,5 +51,7 @@ dynamicJSONDecode :: !JSONNode -> Maybe a
dynamicJSONDecode (JSONArray [JSONString "_DYNAMICENCODE_",JSONString str]) = Just (fst (copy_from_string (base64URLDecode str)))
dynamicJSONDecode _ = Nothing
serializeForClient :: f !*VSt -> *(!String, !*VSt)
serializeForClient f vst=:{VSt| abcInterpreterEnv} = (serialize_for_prelinked_interpretation f abcInterpreterEnv, vst)
serializeForClient :: a !*VSt -> *(!String, !*VSt)
serializeForClient graph vst=:{VSt| abcInterpreterEnv}
# serialized = serialize_for_prelinked_interpretation graph abcInterpreterEnv
= (base64Encode serialized, vst)
......@@ -6,7 +6,7 @@ import iTasks.Internal.IWorld
import iTasks.Internal.Serialization
import iTasks.UI.Definition, iTasks.WF.Definition, iTasks.UI.JavaScript
import qualified Data.Map as DM
import Text, Text.GenJSON, Text.Encodings.Base64
import Text, Text.GenJSON
import Data.GenEq
derive JSONEncode EditState, LeafState, EditMode
......@@ -157,7 +157,7 @@ withClientSideInit initUI genUI attr dp val vst=:{VSt| taskId} = case genUI attr
# extraAttr = 'DM'.fromList
[("taskId", JSONString taskId)
,("editorId",JSONString (editorId dp))
,("initUI", JSONString $ base64Encode initUI)
,("initUI", JSONString initUI)
]
= (Ok (UI type ('DM'.union extraAttr attr) items,mask), vst)
e = e
......@@ -205,7 +205,7 @@ wrapInitUIFunction :: !(JSVal *JSWorld -> *JSWorld) -> {!JSVal} -> *JSWorld -> *
/**
* Deserialize a graph that was serialized using the tools in
* `iTasks.Internal.Client.Serialization`.
* @param The string to deserialize.
* @param The string to deserialize in base64 encoding.
* @result The deserialized value.
*/
jsDeserializeGraph :: !*String !*JSWorld -> *(!.a, !*JSWorld)
......
......@@ -7,6 +7,7 @@ import StdOverloadedList
import Data.Func
import Data.Maybe
import Text.Encodings.Base64
import Text.GenJSON
:: *JSWorld = JSWorld
......@@ -572,7 +573,7 @@ where
}
jsDeserializeGraph :: !*String !*JSWorld -> *(!.a, !*JSWorld)
jsDeserializeGraph s w = (deserialize s, w)
jsDeserializeGraph s w = (deserialize (base64Decode s), w)
where
deserialize :: !*String -> .a
deserialize _ = code {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment