Parses the URL and returns enough arguments that can allow us to re-instantiate this object.
(url)
| 530 | |
| 531 | @staticmethod |
| 532 | def parse_url(url): |
| 533 | """ |
| 534 | Parses the URL and returns enough arguments that can allow us to |
| 535 | re-instantiate this object. |
| 536 | """ |
| 537 | results = NotifyBase.parse_url(url) |
| 538 | if not results: |
| 539 | return results |
| 540 | |
| 541 | # The URL user field carries the public_key (Curve25519 public key). |
| 542 | results["public_key"] = ( |
| 543 | NotifySessionOGS.unquote(results["user"]) |
| 544 | if results.get("user") |
| 545 | else None |
| 546 | ) |
| 547 | |
| 548 | # The URL password field carries the bot's Ed25519 seed. |
| 549 | results["seed"] = ( |
| 550 | NotifySessionOGS.unquote(results["password"]) |
| 551 | if results.get("password") |
| 552 | else None |
| 553 | ) |
| 554 | |
| 555 | # ?key= is the short query-string alias for the public_key. |
| 556 | if "key" in results["qsd"] and results["qsd"]["key"]: |
| 557 | results["public_key"] = NotifySessionOGS.unquote( |
| 558 | results["qsd"]["key"] |
| 559 | ) |
| 560 | |
| 561 | # ?public_key= matches Session's own join-link terminology and |
| 562 | # overrides ?key= when both are present. |
| 563 | if "public_key" in results["qsd"] and results["qsd"]["public_key"]: |
| 564 | results["public_key"] = NotifySessionOGS.unquote( |
| 565 | results["qsd"]["public_key"] |
| 566 | ) |
| 567 | |
| 568 | # ?seed= query param overrides the URL password field. |
| 569 | if "seed" in results["qsd"] and results["qsd"]["seed"]: |
| 570 | results["seed"] = NotifySessionOGS.unquote(results["qsd"]["seed"]) |
| 571 | |
| 572 | # All path segments are room tokens. |
| 573 | results["targets"] = NotifySessionOGS.split_path(results["fullpath"]) |
| 574 | |
| 575 | # ?to= is the project-wide alias for additional room tokens. |
| 576 | if "to" in results["qsd"] and results["qsd"]["to"]: |
| 577 | results["targets"] += NotifySessionOGS.parse_list( |
| 578 | results["qsd"]["to"] |
| 579 | ) |
| 580 | |
| 581 | return results |
| 582 | |
| 583 | @staticmethod |
| 584 | def runtime_deps(): |
nothing calls this directly
no test coverage detected