on master help sign in
Fixed vaultwarden support (#21)
commit69a42ad7f3840972f6ed0bc20348da50f8df7d7d authoriko <ilyakooo0@gmail.com> dateSun 6 Nov 2022, 17:22 (4 years ago) parentae89147
6 files changed+35−4
backend/BW/Logic.purs+4−2 backend/BW/Types.purs+1−1 backend/Bridge.purs+13 bridge.yaml+1 frontend/Bridge.elm+15−1 frontend/Main.elm+1
backend/BW/Logic.purs+4−2
@@ -207,7 +207,8 @@ encodeCipher ::
207207 | r
208208 )
209209 CipherResponse
210−encodeCipher (Bridge.FullCipher { name, cipher, id, favorite, reprompt }) = do
210+encodeCipher
211+ (Bridge.FullCipher { name, cipher, id, favorite, reprompt, collectionIds }) = do
211212 let
212213 f :: CipherResponse -> Run _ CipherResponse
213214 f x = case cipher of
@@ -326,7 +327,7 @@ encodeCipher (Bridge.FullCipher { name, cipher, id, favorite, reprompt }) = do
326327 , revisionDate: jnull
327328 , attachments: jnull
328329 , passwordHistory: jnull
329− , collectionIds: jnull
330+ , collectionIds: nullify $ unwrap collectionIds
330331 , deletedDate: jnull
331332 , reprompt
332333 }
@@ -431,6 +432,7 @@ decodeCipher cipher = do
431432 , id: cipher.id
432433 , favorite: cipher.favorite
433434 , reprompt: cipher.reprompt
435+ , collectionIds: wrap <<< fromJNullable [] $ cipher.collectionIds
434436 }
435437
436438decryptNullable ::
backend/BW/Types.purs+1−1
@@ -618,7 +618,7 @@ type SecureNoteType
618618 = Int
619619
620620type SecureNoteApi = {
621− type :: SecureNoteType
621+ -- type :: SecureNoteType
622622}
623623
624624type AttachmentResponse
backend/Bridge.purs+13
@@ -531,9 +531,22 @@ derive instance genericCmd :: Generic Cmd _
531531derive instance eqCmd :: Eq Cmd
532532derive instance ordCmd :: Ord Cmd
533533
534+newtype FullCipher_collectionIds_List =
535+ FullCipher_collectionIds_List (Array String)
536+
537+derive instance newtypeFullCipher_collectionIds_List :: Newtype FullCipher_collectionIds_List _
538+instance encodeJsonFullCipher_collectionIds_List :: EncodeJson FullCipher_collectionIds_List where
539+ encodeJson = genericEncodeAeson Argonaut.defaultOptions
540+instance decodeJsonFullCipher_collectionIds_List :: DecodeJson FullCipher_collectionIds_List where
541+ decodeJson = genericDecodeAeson Argonaut.defaultOptions
542+derive instance genericFullCipher_collectionIds_List :: Generic FullCipher_collectionIds_List _
543+derive instance eqFullCipher_collectionIds_List :: Eq FullCipher_collectionIds_List
544+derive instance ordFullCipher_collectionIds_List :: Ord FullCipher_collectionIds_List
545+
534546newtype FullCipher =
535547 FullCipher {
536548 cipher :: Cipher
549+ , collectionIds :: FullCipher_collectionIds_List
537550 , favorite :: Boolean
538551 , id :: String
539552 , name :: String
bridge.yaml+1
@@ -62,6 +62,7 @@ FullCipher:
6262 id: String
6363 name: String
6464 cipher: Cipher
65+ collectionIds: { List: String }
6566
6667Cipher:
6768 - LoginCipher:
frontend/Bridge.elm+15−1
@@ -641,8 +641,20 @@ jsonEncCmd val =
641641
642642
643643
644+type alias FullCipher_collectionIds_List = (List String)
645+
646+jsonDecFullCipher_collectionIds_List : Json.Decode.Decoder ( FullCipher_collectionIds_List )
647+jsonDecFullCipher_collectionIds_List =
648+ Json.Decode.list (Json.Decode.string)
649+
650+jsonEncFullCipher_collectionIds_List : FullCipher_collectionIds_List -> Value
651+jsonEncFullCipher_collectionIds_List val = (Json.Encode.list Json.Encode.string) val
652+
653+
654+
644655type alias FullCipher =
645656 { cipher: Cipher
657+ , collectionIds: FullCipher_collectionIds_List
646658 , favorite: Bool
647659 , id: String
648660 , name: String
@@ -651,8 +663,9 @@ type alias FullCipher =
651663
652664jsonDecFullCipher : Json.Decode.Decoder ( FullCipher )
653665jsonDecFullCipher =
654− Json.Decode.succeed (\pcipher pfavorite pid pname preprompt -> {cipher = pcipher, favorite = pfavorite, id = pid, name = pname, reprompt = preprompt})
666+ Json.Decode.succeed (\pcipher pcollectionIds pfavorite pid pname preprompt -> {cipher = pcipher, collectionIds = pcollectionIds, favorite = pfavorite, id = pid, name = pname, reprompt = preprompt})
655667 |> required "cipher" (jsonDecCipher)
668+ |> required "collectionIds" (jsonDecFullCipher_collectionIds_List)
656669 |> required "favorite" (Json.Decode.bool)
657670 |> required "id" (Json.Decode.string)
658671 |> required "name" (Json.Decode.string)
@@ -662,6 +675,7 @@ jsonEncFullCipher : FullCipher -> Value
662675jsonEncFullCipher val =
663676 Json.Encode.object
664677 [ ("cipher", jsonEncCipher val.cipher)
678+ , ("collectionIds", jsonEncFullCipher_collectionIds_List val.collectionIds)
665679 , ("favorite", Json.Encode.bool val.favorite)
666680 , ("id", Json.Encode.string val.id)
667681 , ("name", Json.Encode.string val.name)
frontend/Main.elm+1
@@ -583,6 +583,7 @@ update msg model =
583583 , favorite = False
584584 , id = ""
585585 , name = ""
586+ , collectionIds = []
586587 , cipher =
587588 case t of
588589 Bridge.LoginType ->