Merge branch 'fix/1658-invite-send' into 'develop'
[akkoma] / test / config / config_db_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.ConfigDBTest do
6 use Pleroma.DataCase, async: true
7 import Pleroma.Factory
8 alias Pleroma.ConfigDB
9
10 test "get_by_key/1" do
11 config = insert(:config)
12 insert(:config)
13
14 assert config == ConfigDB.get_by_params(%{group: config.group, key: config.key})
15 end
16
17 test "create/1" do
18 {:ok, config} = ConfigDB.create(%{group: ":pleroma", key: ":some_key", value: "some_value"})
19 assert config == ConfigDB.get_by_params(%{group: ":pleroma", key: ":some_key"})
20 end
21
22 test "update/1" do
23 config = insert(:config)
24 {:ok, updated} = ConfigDB.update(config, %{value: "some_value"})
25 loaded = ConfigDB.get_by_params(%{group: config.group, key: config.key})
26 assert loaded == updated
27 end
28
29 test "get_all_as_keyword/0" do
30 saved = insert(:config)
31 insert(:config, group: ":quack", key: ":level", value: ConfigDB.to_binary(:info))
32 insert(:config, group: ":quack", key: ":meta", value: ConfigDB.to_binary([:none]))
33
34 insert(:config,
35 group: ":quack",
36 key: ":webhook_url",
37 value: ConfigDB.to_binary("https://hooks.slack.com/services/KEY/some_val")
38 )
39
40 config = ConfigDB.get_all_as_keyword()
41
42 assert config[:pleroma] == [
43 {ConfigDB.from_string(saved.key), ConfigDB.from_binary(saved.value)}
44 ]
45
46 assert config[:quack] == [
47 level: :info,
48 meta: [:none],
49 webhook_url: "https://hooks.slack.com/services/KEY/some_val"
50 ]
51 end
52
53 describe "update_or_create/1" do
54 test "common" do
55 config = insert(:config)
56 key2 = "another_key"
57
58 params = [
59 %{group: "pleroma", key: key2, value: "another_value"},
60 %{group: config.group, key: config.key, value: "new_value"}
61 ]
62
63 assert Repo.all(ConfigDB) |> length() == 1
64
65 Enum.each(params, &ConfigDB.update_or_create(&1))
66
67 assert Repo.all(ConfigDB) |> length() == 2
68
69 config1 = ConfigDB.get_by_params(%{group: config.group, key: config.key})
70 config2 = ConfigDB.get_by_params(%{group: "pleroma", key: key2})
71
72 assert config1.value == ConfigDB.transform("new_value")
73 assert config2.value == ConfigDB.transform("another_value")
74 end
75
76 test "partial update" do
77 config = insert(:config, value: ConfigDB.to_binary(key1: "val1", key2: :val2))
78
79 {:ok, _config} =
80 ConfigDB.update_or_create(%{
81 group: config.group,
82 key: config.key,
83 value: [key1: :val1, key3: :val3]
84 })
85
86 updated = ConfigDB.get_by_params(%{group: config.group, key: config.key})
87
88 value = ConfigDB.from_binary(updated.value)
89 assert length(value) == 3
90 assert value[:key1] == :val1
91 assert value[:key2] == :val2
92 assert value[:key3] == :val3
93 end
94
95 test "deep merge" do
96 config = insert(:config, value: ConfigDB.to_binary(key1: "val1", key2: [k1: :v1, k2: "v2"]))
97
98 {:ok, config} =
99 ConfigDB.update_or_create(%{
100 group: config.group,
101 key: config.key,
102 value: [key1: :val1, key2: [k2: :v2, k3: :v3], key3: :val3]
103 })
104
105 updated = ConfigDB.get_by_params(%{group: config.group, key: config.key})
106
107 assert config.value == updated.value
108
109 value = ConfigDB.from_binary(updated.value)
110 assert value[:key1] == :val1
111 assert value[:key2] == [k1: :v1, k2: :v2, k3: :v3]
112 assert value[:key3] == :val3
113 end
114
115 test "only full update for some keys" do
116 config1 = insert(:config, key: ":ecto_repos", value: ConfigDB.to_binary(repo: Pleroma.Repo))
117
118 config2 =
119 insert(:config, group: ":cors_plug", key: ":max_age", value: ConfigDB.to_binary(18))
120
121 {:ok, _config} =
122 ConfigDB.update_or_create(%{
123 group: config1.group,
124 key: config1.key,
125 value: [another_repo: [Pleroma.Repo]]
126 })
127
128 {:ok, _config} =
129 ConfigDB.update_or_create(%{
130 group: config2.group,
131 key: config2.key,
132 value: 777
133 })
134
135 updated1 = ConfigDB.get_by_params(%{group: config1.group, key: config1.key})
136 updated2 = ConfigDB.get_by_params(%{group: config2.group, key: config2.key})
137
138 assert ConfigDB.from_binary(updated1.value) == [another_repo: [Pleroma.Repo]]
139 assert ConfigDB.from_binary(updated2.value) == 777
140 end
141
142 test "full update if value is not keyword" do
143 config =
144 insert(:config,
145 group: ":tesla",
146 key: ":adapter",
147 value: ConfigDB.to_binary(Tesla.Adapter.Hackney)
148 )
149
150 {:ok, _config} =
151 ConfigDB.update_or_create(%{
152 group: config.group,
153 key: config.key,
154 value: Tesla.Adapter.Httpc
155 })
156
157 updated = ConfigDB.get_by_params(%{group: config.group, key: config.key})
158
159 assert ConfigDB.from_binary(updated.value) == Tesla.Adapter.Httpc
160 end
161
162 test "only full update for some subkeys" do
163 config1 =
164 insert(:config,
165 key: ":emoji",
166 value: ConfigDB.to_binary(groups: [a: 1, b: 2], key: [a: 1])
167 )
168
169 config2 =
170 insert(:config,
171 key: ":assets",
172 value: ConfigDB.to_binary(mascots: [a: 1, b: 2], key: [a: 1])
173 )
174
175 {:ok, _config} =
176 ConfigDB.update_or_create(%{
177 group: config1.group,
178 key: config1.key,
179 value: [groups: [c: 3, d: 4], key: [b: 2]]
180 })
181
182 {:ok, _config} =
183 ConfigDB.update_or_create(%{
184 group: config2.group,
185 key: config2.key,
186 value: [mascots: [c: 3, d: 4], key: [b: 2]]
187 })
188
189 updated1 = ConfigDB.get_by_params(%{group: config1.group, key: config1.key})
190 updated2 = ConfigDB.get_by_params(%{group: config2.group, key: config2.key})
191
192 assert ConfigDB.from_binary(updated1.value) == [groups: [c: 3, d: 4], key: [a: 1, b: 2]]
193 assert ConfigDB.from_binary(updated2.value) == [mascots: [c: 3, d: 4], key: [a: 1, b: 2]]
194 end
195 end
196
197 describe "delete/1" do
198 test "error on deleting non existing setting" do
199 {:error, error} = ConfigDB.delete(%{group: ":pleroma", key: ":key"})
200 assert error =~ "Config with params %{group: \":pleroma\", key: \":key\"} not found"
201 end
202
203 test "full delete" do
204 config = insert(:config)
205 {:ok, deleted} = ConfigDB.delete(%{group: config.group, key: config.key})
206 assert Ecto.get_meta(deleted, :state) == :deleted
207 refute ConfigDB.get_by_params(%{group: config.group, key: config.key})
208 end
209
210 test "partial subkeys delete" do
211 config = insert(:config, value: ConfigDB.to_binary(groups: [a: 1, b: 2], key: [a: 1]))
212
213 {:ok, deleted} =
214 ConfigDB.delete(%{group: config.group, key: config.key, subkeys: [":groups"]})
215
216 assert Ecto.get_meta(deleted, :state) == :loaded
217
218 assert deleted.value == ConfigDB.to_binary(key: [a: 1])
219
220 updated = ConfigDB.get_by_params(%{group: config.group, key: config.key})
221
222 assert updated.value == deleted.value
223 end
224
225 test "full delete if remaining value after subkeys deletion is empty list" do
226 config = insert(:config, value: ConfigDB.to_binary(groups: [a: 1, b: 2]))
227
228 {:ok, deleted} =
229 ConfigDB.delete(%{group: config.group, key: config.key, subkeys: [":groups"]})
230
231 assert Ecto.get_meta(deleted, :state) == :deleted
232
233 refute ConfigDB.get_by_params(%{group: config.group, key: config.key})
234 end
235 end
236
237 describe "transform/1" do
238 test "string" do
239 binary = ConfigDB.transform("value as string")
240 assert binary == :erlang.term_to_binary("value as string")
241 assert ConfigDB.from_binary(binary) == "value as string"
242 end
243
244 test "boolean" do
245 binary = ConfigDB.transform(false)
246 assert binary == :erlang.term_to_binary(false)
247 assert ConfigDB.from_binary(binary) == false
248 end
249
250 test "nil" do
251 binary = ConfigDB.transform(nil)
252 assert binary == :erlang.term_to_binary(nil)
253 assert ConfigDB.from_binary(binary) == nil
254 end
255
256 test "integer" do
257 binary = ConfigDB.transform(150)
258 assert binary == :erlang.term_to_binary(150)
259 assert ConfigDB.from_binary(binary) == 150
260 end
261
262 test "atom" do
263 binary = ConfigDB.transform(":atom")
264 assert binary == :erlang.term_to_binary(:atom)
265 assert ConfigDB.from_binary(binary) == :atom
266 end
267
268 test "ssl options" do
269 binary = ConfigDB.transform([":tlsv1", ":tlsv1.1", ":tlsv1.2"])
270 assert binary == :erlang.term_to_binary([:tlsv1, :"tlsv1.1", :"tlsv1.2"])
271 assert ConfigDB.from_binary(binary) == [:tlsv1, :"tlsv1.1", :"tlsv1.2"]
272 end
273
274 test "pleroma module" do
275 binary = ConfigDB.transform("Pleroma.Bookmark")
276 assert binary == :erlang.term_to_binary(Pleroma.Bookmark)
277 assert ConfigDB.from_binary(binary) == Pleroma.Bookmark
278 end
279
280 test "pleroma string" do
281 binary = ConfigDB.transform("Pleroma")
282 assert binary == :erlang.term_to_binary("Pleroma")
283 assert ConfigDB.from_binary(binary) == "Pleroma"
284 end
285
286 test "phoenix module" do
287 binary = ConfigDB.transform("Phoenix.Socket.V1.JSONSerializer")
288 assert binary == :erlang.term_to_binary(Phoenix.Socket.V1.JSONSerializer)
289 assert ConfigDB.from_binary(binary) == Phoenix.Socket.V1.JSONSerializer
290 end
291
292 test "tesla module" do
293 binary = ConfigDB.transform("Tesla.Adapter.Hackney")
294 assert binary == :erlang.term_to_binary(Tesla.Adapter.Hackney)
295 assert ConfigDB.from_binary(binary) == Tesla.Adapter.Hackney
296 end
297
298 test "ExSyslogger module" do
299 binary = ConfigDB.transform("ExSyslogger")
300 assert binary == :erlang.term_to_binary(ExSyslogger)
301 assert ConfigDB.from_binary(binary) == ExSyslogger
302 end
303
304 test "Quack.Logger module" do
305 binary = ConfigDB.transform("Quack.Logger")
306 assert binary == :erlang.term_to_binary(Quack.Logger)
307 assert ConfigDB.from_binary(binary) == Quack.Logger
308 end
309
310 test "Swoosh.Adapters modules" do
311 binary = ConfigDB.transform("Swoosh.Adapters.SMTP")
312 assert binary == :erlang.term_to_binary(Swoosh.Adapters.SMTP)
313 assert ConfigDB.from_binary(binary) == Swoosh.Adapters.SMTP
314 binary = ConfigDB.transform("Swoosh.Adapters.AmazonSES")
315 assert binary == :erlang.term_to_binary(Swoosh.Adapters.AmazonSES)
316 assert ConfigDB.from_binary(binary) == Swoosh.Adapters.AmazonSES
317 end
318
319 test "sigil" do
320 binary = ConfigDB.transform("~r[comp[lL][aA][iI][nN]er]")
321 assert binary == :erlang.term_to_binary(~r/comp[lL][aA][iI][nN]er/)
322 assert ConfigDB.from_binary(binary) == ~r/comp[lL][aA][iI][nN]er/
323 end
324
325 test "link sigil" do
326 binary = ConfigDB.transform("~r/https:\/\/example.com/")
327 assert binary == :erlang.term_to_binary(~r/https:\/\/example.com/)
328 assert ConfigDB.from_binary(binary) == ~r/https:\/\/example.com/
329 end
330
331 test "link sigil with um modifiers" do
332 binary = ConfigDB.transform("~r/https:\/\/example.com/um")
333 assert binary == :erlang.term_to_binary(~r/https:\/\/example.com/um)
334 assert ConfigDB.from_binary(binary) == ~r/https:\/\/example.com/um
335 end
336
337 test "link sigil with i modifier" do
338 binary = ConfigDB.transform("~r/https:\/\/example.com/i")
339 assert binary == :erlang.term_to_binary(~r/https:\/\/example.com/i)
340 assert ConfigDB.from_binary(binary) == ~r/https:\/\/example.com/i
341 end
342
343 test "link sigil with s modifier" do
344 binary = ConfigDB.transform("~r/https:\/\/example.com/s")
345 assert binary == :erlang.term_to_binary(~r/https:\/\/example.com/s)
346 assert ConfigDB.from_binary(binary) == ~r/https:\/\/example.com/s
347 end
348
349 test "raise if valid delimiter not found" do
350 assert_raise ArgumentError, "valid delimiter for Regex expression not found", fn ->
351 ConfigDB.transform("~r/https://[]{}<>\"'()|example.com/s")
352 end
353 end
354
355 test "2 child tuple" do
356 binary = ConfigDB.transform(%{"tuple" => ["v1", ":v2"]})
357 assert binary == :erlang.term_to_binary({"v1", :v2})
358 assert ConfigDB.from_binary(binary) == {"v1", :v2}
359 end
360
361 test "proxy tuple with localhost" do
362 binary =
363 ConfigDB.transform(%{
364 "tuple" => [":proxy_url", %{"tuple" => [":socks5", "localhost", 1234]}]
365 })
366
367 assert binary == :erlang.term_to_binary({:proxy_url, {:socks5, :localhost, 1234}})
368 assert ConfigDB.from_binary(binary) == {:proxy_url, {:socks5, :localhost, 1234}}
369 end
370
371 test "proxy tuple with domain" do
372 binary =
373 ConfigDB.transform(%{
374 "tuple" => [":proxy_url", %{"tuple" => [":socks5", "domain.com", 1234]}]
375 })
376
377 assert binary == :erlang.term_to_binary({:proxy_url, {:socks5, 'domain.com', 1234}})
378 assert ConfigDB.from_binary(binary) == {:proxy_url, {:socks5, 'domain.com', 1234}}
379 end
380
381 test "proxy tuple with ip" do
382 binary =
383 ConfigDB.transform(%{
384 "tuple" => [":proxy_url", %{"tuple" => [":socks5", "127.0.0.1", 1234]}]
385 })
386
387 assert binary == :erlang.term_to_binary({:proxy_url, {:socks5, {127, 0, 0, 1}, 1234}})
388 assert ConfigDB.from_binary(binary) == {:proxy_url, {:socks5, {127, 0, 0, 1}, 1234}}
389 end
390
391 test "tuple with n childs" do
392 binary =
393 ConfigDB.transform(%{
394 "tuple" => [
395 "v1",
396 ":v2",
397 "Pleroma.Bookmark",
398 150,
399 false,
400 "Phoenix.Socket.V1.JSONSerializer"
401 ]
402 })
403
404 assert binary ==
405 :erlang.term_to_binary(
406 {"v1", :v2, Pleroma.Bookmark, 150, false, Phoenix.Socket.V1.JSONSerializer}
407 )
408
409 assert ConfigDB.from_binary(binary) ==
410 {"v1", :v2, Pleroma.Bookmark, 150, false, Phoenix.Socket.V1.JSONSerializer}
411 end
412
413 test "map with string key" do
414 binary = ConfigDB.transform(%{"key" => "value"})
415 assert binary == :erlang.term_to_binary(%{"key" => "value"})
416 assert ConfigDB.from_binary(binary) == %{"key" => "value"}
417 end
418
419 test "map with atom key" do
420 binary = ConfigDB.transform(%{":key" => "value"})
421 assert binary == :erlang.term_to_binary(%{key: "value"})
422 assert ConfigDB.from_binary(binary) == %{key: "value"}
423 end
424
425 test "list of strings" do
426 binary = ConfigDB.transform(["v1", "v2", "v3"])
427 assert binary == :erlang.term_to_binary(["v1", "v2", "v3"])
428 assert ConfigDB.from_binary(binary) == ["v1", "v2", "v3"]
429 end
430
431 test "list of modules" do
432 binary = ConfigDB.transform(["Pleroma.Repo", "Pleroma.Activity"])
433 assert binary == :erlang.term_to_binary([Pleroma.Repo, Pleroma.Activity])
434 assert ConfigDB.from_binary(binary) == [Pleroma.Repo, Pleroma.Activity]
435 end
436
437 test "list of atoms" do
438 binary = ConfigDB.transform([":v1", ":v2", ":v3"])
439 assert binary == :erlang.term_to_binary([:v1, :v2, :v3])
440 assert ConfigDB.from_binary(binary) == [:v1, :v2, :v3]
441 end
442
443 test "list of mixed values" do
444 binary =
445 ConfigDB.transform([
446 "v1",
447 ":v2",
448 "Pleroma.Repo",
449 "Phoenix.Socket.V1.JSONSerializer",
450 15,
451 false
452 ])
453
454 assert binary ==
455 :erlang.term_to_binary([
456 "v1",
457 :v2,
458 Pleroma.Repo,
459 Phoenix.Socket.V1.JSONSerializer,
460 15,
461 false
462 ])
463
464 assert ConfigDB.from_binary(binary) == [
465 "v1",
466 :v2,
467 Pleroma.Repo,
468 Phoenix.Socket.V1.JSONSerializer,
469 15,
470 false
471 ]
472 end
473
474 test "simple keyword" do
475 binary = ConfigDB.transform([%{"tuple" => [":key", "value"]}])
476 assert binary == :erlang.term_to_binary([{:key, "value"}])
477 assert ConfigDB.from_binary(binary) == [{:key, "value"}]
478 assert ConfigDB.from_binary(binary) == [key: "value"]
479 end
480
481 test "keyword" do
482 binary =
483 ConfigDB.transform([
484 %{"tuple" => [":types", "Pleroma.PostgresTypes"]},
485 %{"tuple" => [":telemetry_event", ["Pleroma.Repo.Instrumenter"]]},
486 %{"tuple" => [":migration_lock", nil]},
487 %{"tuple" => [":key1", 150]},
488 %{"tuple" => [":key2", "string"]}
489 ])
490
491 assert binary ==
492 :erlang.term_to_binary(
493 types: Pleroma.PostgresTypes,
494 telemetry_event: [Pleroma.Repo.Instrumenter],
495 migration_lock: nil,
496 key1: 150,
497 key2: "string"
498 )
499
500 assert ConfigDB.from_binary(binary) == [
501 types: Pleroma.PostgresTypes,
502 telemetry_event: [Pleroma.Repo.Instrumenter],
503 migration_lock: nil,
504 key1: 150,
505 key2: "string"
506 ]
507 end
508
509 test "complex keyword with nested mixed childs" do
510 binary =
511 ConfigDB.transform([
512 %{"tuple" => [":uploader", "Pleroma.Uploaders.Local"]},
513 %{"tuple" => [":filters", ["Pleroma.Upload.Filter.Dedupe"]]},
514 %{"tuple" => [":link_name", true]},
515 %{"tuple" => [":proxy_remote", false]},
516 %{"tuple" => [":common_map", %{":key" => "value"}]},
517 %{
518 "tuple" => [
519 ":proxy_opts",
520 [
521 %{"tuple" => [":redirect_on_failure", false]},
522 %{"tuple" => [":max_body_length", 1_048_576]},
523 %{
524 "tuple" => [
525 ":http",
526 [%{"tuple" => [":follow_redirect", true]}, %{"tuple" => [":pool", ":upload"]}]
527 ]
528 }
529 ]
530 ]
531 }
532 ])
533
534 assert binary ==
535 :erlang.term_to_binary(
536 uploader: Pleroma.Uploaders.Local,
537 filters: [Pleroma.Upload.Filter.Dedupe],
538 link_name: true,
539 proxy_remote: false,
540 common_map: %{key: "value"},
541 proxy_opts: [
542 redirect_on_failure: false,
543 max_body_length: 1_048_576,
544 http: [
545 follow_redirect: true,
546 pool: :upload
547 ]
548 ]
549 )
550
551 assert ConfigDB.from_binary(binary) ==
552 [
553 uploader: Pleroma.Uploaders.Local,
554 filters: [Pleroma.Upload.Filter.Dedupe],
555 link_name: true,
556 proxy_remote: false,
557 common_map: %{key: "value"},
558 proxy_opts: [
559 redirect_on_failure: false,
560 max_body_length: 1_048_576,
561 http: [
562 follow_redirect: true,
563 pool: :upload
564 ]
565 ]
566 ]
567 end
568
569 test "common keyword" do
570 binary =
571 ConfigDB.transform([
572 %{"tuple" => [":level", ":warn"]},
573 %{"tuple" => [":meta", [":all"]]},
574 %{"tuple" => [":path", ""]},
575 %{"tuple" => [":val", nil]},
576 %{"tuple" => [":webhook_url", "https://hooks.slack.com/services/YOUR-KEY-HERE"]}
577 ])
578
579 assert binary ==
580 :erlang.term_to_binary(
581 level: :warn,
582 meta: [:all],
583 path: "",
584 val: nil,
585 webhook_url: "https://hooks.slack.com/services/YOUR-KEY-HERE"
586 )
587
588 assert ConfigDB.from_binary(binary) == [
589 level: :warn,
590 meta: [:all],
591 path: "",
592 val: nil,
593 webhook_url: "https://hooks.slack.com/services/YOUR-KEY-HERE"
594 ]
595 end
596
597 test "complex keyword with sigil" do
598 binary =
599 ConfigDB.transform([
600 %{"tuple" => [":federated_timeline_removal", []]},
601 %{"tuple" => [":reject", ["~r/comp[lL][aA][iI][nN]er/"]]},
602 %{"tuple" => [":replace", []]}
603 ])
604
605 assert binary ==
606 :erlang.term_to_binary(
607 federated_timeline_removal: [],
608 reject: [~r/comp[lL][aA][iI][nN]er/],
609 replace: []
610 )
611
612 assert ConfigDB.from_binary(binary) ==
613 [federated_timeline_removal: [], reject: [~r/comp[lL][aA][iI][nN]er/], replace: []]
614 end
615
616 test "complex keyword with tuples with more than 2 values" do
617 binary =
618 ConfigDB.transform([
619 %{
620 "tuple" => [
621 ":http",
622 [
623 %{
624 "tuple" => [
625 ":key1",
626 [
627 %{
628 "tuple" => [
629 ":_",
630 [
631 %{
632 "tuple" => [
633 "/api/v1/streaming",
634 "Pleroma.Web.MastodonAPI.WebsocketHandler",
635 []
636 ]
637 },
638 %{
639 "tuple" => [
640 "/websocket",
641 "Phoenix.Endpoint.CowboyWebSocket",
642 %{
643 "tuple" => [
644 "Phoenix.Transports.WebSocket",
645 %{
646 "tuple" => [
647 "Pleroma.Web.Endpoint",
648 "Pleroma.Web.UserSocket",
649 []
650 ]
651 }
652 ]
653 }
654 ]
655 },
656 %{
657 "tuple" => [
658 ":_",
659 "Phoenix.Endpoint.Cowboy2Handler",
660 %{"tuple" => ["Pleroma.Web.Endpoint", []]}
661 ]
662 }
663 ]
664 ]
665 }
666 ]
667 ]
668 }
669 ]
670 ]
671 }
672 ])
673
674 assert binary ==
675 :erlang.term_to_binary(
676 http: [
677 key1: [
678 _: [
679 {"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
680 {"/websocket", Phoenix.Endpoint.CowboyWebSocket,
681 {Phoenix.Transports.WebSocket,
682 {Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, []}}},
683 {:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}
684 ]
685 ]
686 ]
687 )
688
689 assert ConfigDB.from_binary(binary) == [
690 http: [
691 key1: [
692 {:_,
693 [
694 {"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
695 {"/websocket", Phoenix.Endpoint.CowboyWebSocket,
696 {Phoenix.Transports.WebSocket,
697 {Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, []}}},
698 {:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}
699 ]}
700 ]
701 ]
702 ]
703 end
704 end
705 end