thedevs-network / kutt

Free Modern URL Shortener.
https://kutt.it
MIT License
8.35k stars 1.08k forks source link

Same custom domain for multiple users #494

Open cierzniak opened 3 years ago

cierzniak commented 3 years ago

Hi, I've got Kutt instance on Swarm cluster via Traefik. To protect it I use traefik-forward-auth (which works great) and real shorting domains are other than app intance.

Eg. Kutt is available at shorter.example.com and custom domains are link.example.com and exmpl.com.

All redirects works fine but management is impossible at the moment. Tested at latest and develop Docker image labels.

The problem

On my main account (admin set at ADMIN_EMAILS variable) after adding both domains, my co-workers don't see these domains and also they can't add them twice (You can't add this domain. validation info). After promoting them to admin problem still exists.

Response from GET /api/v2/users:

my admin account (admin@example.com)
{
  "apikey": "@redacted",
  "email": "admin@example.com",
  "domains": [
    {
      "id": "aa874dea-a903-4c6d-8dda-a5b1d1ae7ce4",
      "banned": false,
      "address": "exmpl.com",
      "homepage": "https://example.com",
      "created_at": "2021-07-15T07:12:15.157Z",
      "updated_at": "2021-07-15T07:12:28.235Z"
    }
    {
      "id": "e5f52068-cd81-469d-b512-c7e6795de37c",
      "banned": false,
      "address": "link.example.com",
      "homepage": "https://example.com",
      "created_at": "2021-07-15T07:14:41.326Z",
      "updated_at": "2021-07-15T07:14:54.799Z"
    }
  ]
}
promoted admin account (co-worker@example.com)
{
  "apikey": null,
  "email": "co-worker@example.com",
  "domains": []
}

Kutt swarm stack

version: '3.8'

services:
  kutt:
    image: kutt/kutt:develop
    command: [ "./wait-for-it.sh", "database:5432", "--", "npm", "start" ]
    environment:
      DB_HOST: database
      DB_NAME: kutt
      DB_USER: kutt
      DB_PASSWORD: s3cret
      REDIS_HOST: redis
      SITE_NAME: Our Link Shortener
      DEFAULT_DOMAIN: shorter.example.com
      DISALLOW_REGISTRATION: 'false'
      DISALLOW_ANONYMOUS_LINKS: 'true'
      CUSTOM_DOMAIN_USE_HTTPS:  'true'
      JWT_SECRET: '@redacted'
      ADMIN_EMAILS: admin@example.com,co-worker@example.com
      REPORT_EMAIL: co-worker@example.com
      MAIL_FROM: shorter@example.com
      MAIL_HOST: mailgun-alternative
      MAIL_PORT: 587
      MAIL_SECURE: 'false'
      MAIL_USER: '@redacted'
      MAIL_PASSWORD: '@redacted'
    networks: [ default, reverse_proxy ]
    deploy:
      labels:
        traefik.enable: 'true'
        traefik.http.routers.link_shortener-kutt.rule: Host(`shorter.example.com`)
        traefik.http.routers.link_shortener-kutt.entrypoints: web
        traefik.http.routers.link_shortener-kutt.middlewares: traefik-forward-auth
        traefik.http.routers.link_shortener-kutt.service: link_shortener-kutt
        traefik.http.services.link_shortener-kutt.loadbalancer.server.port: 3000
        traefik.http.routers.link_shortener-redirect.rule: Host(`link.example.com`, `exmpl.com`)
        traefik.http.routers.link_shortener-redirect.entrypoints: web
        traefik.http.routers.link_shortener-redirect.service: link_shortener-kutt
  database:
    image: postgres:12-alpine
    environment:
      POSTGRES_USER: kutt
      POSTGRES_PASSWORD: s3cret
      POSTGRES_DB: kutt
    volumes: [ database_data:/var/lib/postgresql/data:rw ]
    networks: [ default ]
  redis:
    image: redis:6-alpine
    volumes: [ redis_data:/data:rw ]
    networks: [ default ]

volumes:
  database_data: ~
  redis_data: ~

networks:
  default: ~
  reverse_proxy:
    external: true
poeti8 commented 3 years ago

Each domain added belongs only to one user and can not be used by another user. We're planning on adding "teams" so multiple users can access same features but it's for distant future.

liukch commented 2 years ago

I really need this feature I use Kutt for self-hosted service, this means I can not share Kutt for any other co-workers, it is just for myself.

SecureCPU commented 1 year ago

Was the teams feature ever added to allow for domain sharing?

SecureCPU commented 1 year ago

Was the teams feature ever added to allow for domain sharing?

Just checking in again to see if this feature is still on any roadmap. Currently use kutt and would love to have this feature or even to be able to make multiple domains available to the public.

Thanks!!