@@ -699,7 +699,9 @@ async fn handle_create(
699699) -> Result < impl IntoResponse , ApiError > {
700700 authorize ( & headers, & state, true ) ?;
701701 if state. read_only {
702- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
702+ return Err ( ApiError :: forbidden (
703+ "Write operations disabled in read-only mode" ,
704+ ) ) ;
703705 }
704706 let store = state. store . lock ( ) . await ;
705707 let mut embedder = state. embedder . lock ( ) . await ;
@@ -731,7 +733,9 @@ async fn handle_append(
731733) -> Result < impl IntoResponse , ApiError > {
732734 authorize ( & headers, & state, true ) ?;
733735 if state. read_only {
734- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
736+ return Err ( ApiError :: forbidden (
737+ "Write operations disabled in read-only mode" ,
738+ ) ) ;
735739 }
736740 let store = state. store . lock ( ) . await ;
737741 let mut embedder = state. embedder . lock ( ) . await ;
@@ -754,7 +758,9 @@ async fn handle_edit(
754758) -> Result < impl IntoResponse , ApiError > {
755759 authorize ( & headers, & state, true ) ?;
756760 if state. read_only {
757- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
761+ return Err ( ApiError :: forbidden (
762+ "Write operations disabled in read-only mode" ,
763+ ) ) ;
758764 }
759765 let store = state. store . lock ( ) . await ;
760766 let mode = match body. mode . as_deref ( ) . unwrap_or ( "append" ) {
@@ -783,7 +789,9 @@ async fn handle_rewrite(
783789) -> Result < impl IntoResponse , ApiError > {
784790 authorize ( & headers, & state, true ) ?;
785791 if state. read_only {
786- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
792+ return Err ( ApiError :: forbidden (
793+ "Write operations disabled in read-only mode" ,
794+ ) ) ;
787795 }
788796 let store = state. store . lock ( ) . await ;
789797 let input = RewriteInput {
@@ -806,7 +814,9 @@ async fn handle_edit_frontmatter(
806814) -> Result < impl IntoResponse , ApiError > {
807815 authorize ( & headers, & state, true ) ?;
808816 if state. read_only {
809- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
817+ return Err ( ApiError :: forbidden (
818+ "Write operations disabled in read-only mode" ,
819+ ) ) ;
810820 }
811821 let ops = parse_frontmatter_ops ( & body. operations ) ?;
812822 let store = state. store . lock ( ) . await ;
@@ -829,7 +839,9 @@ async fn handle_move(
829839) -> Result < impl IntoResponse , ApiError > {
830840 authorize ( & headers, & state, true ) ?;
831841 if state. read_only {
832- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
842+ return Err ( ApiError :: forbidden (
843+ "Write operations disabled in read-only mode" ,
844+ ) ) ;
833845 }
834846 let store = state. store . lock ( ) . await ;
835847 let result = writer:: move_note ( & body. file , & body. new_folder , & store, & state. vault_path )
@@ -846,7 +858,9 @@ async fn handle_archive(
846858) -> Result < impl IntoResponse , ApiError > {
847859 authorize ( & headers, & state, true ) ?;
848860 if state. read_only {
849- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
861+ return Err ( ApiError :: forbidden (
862+ "Write operations disabled in read-only mode" ,
863+ ) ) ;
850864 }
851865 let store = state. store . lock ( ) . await ;
852866 let result = writer:: archive_note (
@@ -868,7 +882,9 @@ async fn handle_unarchive(
868882) -> Result < impl IntoResponse , ApiError > {
869883 authorize ( & headers, & state, true ) ?;
870884 if state. read_only {
871- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
885+ return Err ( ApiError :: forbidden (
886+ "Write operations disabled in read-only mode" ,
887+ ) ) ;
872888 }
873889 let store = state. store . lock ( ) . await ;
874890 let mut embedder = state. embedder . lock ( ) . await ;
@@ -886,7 +902,9 @@ async fn handle_update_metadata(
886902) -> Result < impl IntoResponse , ApiError > {
887903 authorize ( & headers, & state, true ) ?;
888904 if state. read_only {
889- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
905+ return Err ( ApiError :: forbidden (
906+ "Write operations disabled in read-only mode" ,
907+ ) ) ;
890908 }
891909 let store = state. store . lock ( ) . await ;
892910 let input = UpdateMetadataInput {
@@ -912,7 +930,9 @@ async fn handle_migrate_preview(
912930) -> Result < impl IntoResponse , ApiError > {
913931 authorize ( & headers, & state, true ) ?;
914932 if state. read_only {
915- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
933+ return Err ( ApiError :: forbidden (
934+ "Write operations disabled in read-only mode" ,
935+ ) ) ;
916936 }
917937 let store = state. store . lock ( ) . await ;
918938 let profile_ref = state. profile . as_ref ( ) . as_ref ( ) ;
@@ -933,7 +953,9 @@ async fn handle_migrate_apply(
933953) -> Result < impl IntoResponse , ApiError > {
934954 authorize ( & headers, & state, true ) ?;
935955 if state. read_only {
936- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
956+ return Err ( ApiError :: forbidden (
957+ "Write operations disabled in read-only mode" ,
958+ ) ) ;
937959 }
938960 let store = state. store . lock ( ) . await ;
939961 let preview: crate :: migrate:: MigrationPreview = serde_json:: from_value ( body. preview )
@@ -949,7 +971,9 @@ async fn handle_migrate_undo(
949971) -> Result < impl IntoResponse , ApiError > {
950972 authorize ( & headers, & state, true ) ?;
951973 if state. read_only {
952- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
974+ return Err ( ApiError :: forbidden (
975+ "Write operations disabled in read-only mode" ,
976+ ) ) ;
953977 }
954978 let store = state. store . lock ( ) . await ;
955979 let result = crate :: migrate:: undo_last ( & store, & state. vault_path )
@@ -964,7 +988,9 @@ async fn handle_delete(
964988) -> Result < impl IntoResponse , ApiError > {
965989 authorize ( & headers, & state, true ) ?;
966990 if state. read_only {
967- return Err ( ApiError :: forbidden ( "Write operations disabled in read-only mode" ) ) ;
991+ return Err ( ApiError :: forbidden (
992+ "Write operations disabled in read-only mode" ,
993+ ) ) ;
968994 }
969995 let store = state. store . lock ( ) . await ;
970996 let mode = match body. mode . as_deref ( ) . unwrap_or ( "soft" ) {
0 commit comments