nextcloud / social

šŸŽ‰ Social can be used for work, or to connect to the fediverse!
https://apps.nextcloud.com/apps/social
GNU Affero General Public License v3.0
489 stars 59 forks source link

Current restrictions due to hardcoded url in database #28

Closed juliushaertl closed 5 years ago

juliushaertl commented 5 years ago

@daita Don't we have any possibility to just keep the domain out of the database and add the domain prefix for the activity pub urls dynamically on each request?

E.g. we have cloud1.example.com and cloud2.example.com which are both trusted domains of the same Nextcloud instance.

Request https://cloud1.example.com/index.php/apps/social/@admin would return

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1"
  ],
  "id": "https://cloud1.example.com/index.php/apps/social/@admin",
  "type": "Person",
  "url": "https://cloud1.example.com/index.php/apps/social/@admin",
  "aliases": [
    "@admin",
    "users/admin"
  ],
  "preferredUsername": "admin",
  "name": "",
  "inbox": "https://cloud1.example.com/index.php/apps/social/@admin/inbox",
  "outbox": "https://cloud1.example.com/index.php/apps/social/@admin/outbox",
  "account": "",
  "following": "https://cloud1.example.com/index.php/apps/social/@admin/following",
  "followers": "https://cloud1.example.com/index.php/apps/social/@admin/followers",
  "endpoints": {
    "sharedInbox": "https://cloud1.example.com/index.php/apps/social/inbox"
  },
  "publicKey": {
    "id": "https://cloud1.example.com/index.php/apps/social/@admin#main-key",
    "owner": "https://cloud1.example.com/index.php/apps/social/@admin",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0vtHX723CgzuL1MmSr/0\nso5seUsbfUQn8t7OZiOdxCD3o9uX08P3YlkNKirf/C0nruXTgxXLXPc7j5zTy9U7\nhl3apLMOZ83YPqxVVD+3lJwHRuTVEkwdcPYaYIlC3QlgrUC4i+WLy7G0E4jERc+L\n4Rhdv1pQ0xQcRQh36w9lAkmkX5/AaTcdRKK/93ZqCcdq6ZQcawYKRe091aNKyjZe\nkVGjKB90Q8ra+WCaQTnKWafh+lZ5gRHbkKZr0BoN2BxqkaxysS/IvR7esMuDLHwI\nzdgVj8EUf7eghG9ibdXWb6icedR2u6+9akIEpsnADko5MDLSI2JRZh6lQyXnWEgs\nKwIDAQAB\n-----END PUBLIC KEY-----\n"
  }
}

Request https://cloud2.example.com/index.php/apps/social/@admin would return

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1"
  ],
  "id": "https://cloud2.example.com/index.php/apps/social/@admin",
  "type": "Person",
  "url": "https://cloud2.example.com/index.php/apps/social/@admin",
  "aliases": [
    "@admin",
    "users/admin"
  ],
  "preferredUsername": "admin",
  "name": "",
  "inbox": "https://cloud2.example.com/index.php/apps/social/@admin/inbox",
  "outbox": "https://cloud2.example.com/index.php/apps/social/@admin/outbox",
  "account": "",
  "following": "https://cloud2.example.com/index.php/apps/social/@admin/following",
  "followers": "https://cloud2.example.com/index.php/apps/social/@admin/followers",
  "endpoints": {
    "sharedInbox": "https://cloud2.example.com/index.php/apps/social/inbox"
  },
  "publicKey": {
    "id": "https://cloud2.example.com/index.php/apps/social/@admin#main-key",
    "owner": "https://cloud2.example.com/index.php/apps/social/@admin",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0vtHX723CgzuL1MmSr/0\nso5seUsbfUQn8t7OZiOdxCD3o9uX08P3YlkNKirf/C0nruXTgxXLXPc7j5zTy9U7\nhl3apLMOZ83YPqxVVD+3lJwHRuTVEkwdcPYaYIlC3QlgrUC4i+WLy7G0E4jERc+L\n4Rhdv1pQ0xQcRQh36w9lAkmkX5/AaTcdRKK/93ZqCcdq6ZQcawYKRe091aNKyjZe\nkVGjKB90Q8ra+WCaQTnKWafh+lZ5gRHbkKZr0BoN2BxqkaxysS/IvR7esMuDLHwI\nzdgVj8EUf7eghG9ibdXWb6icedR2u6+9akIEpsnADko5MDLSI2JRZh6lQyXnWEgs\nKwIDAQAB\n-----END PUBLIC KEY-----\n"
  }
}
ArtificialOwl commented 5 years ago

we're not using overwrite.cli.url anymore, host must be set in the admin settings page, and should not be changed once used.

Theoretically, changing the address for the social app would require to drop all data from database. Now, if someone wants to change all ids in all table, this might be a working solution, but will still bring issues.