mollyim / mollysocket

MollySocket allows getting Signal notifications via UnifiedPush.
GNU Affero General Public License v3.0
89 stars 7 forks source link

Adding connections doesn't work #11

Closed Fr0d0Beutl1n closed 9 months ago

Fr0d0Beutl1n commented 9 months ago

I'm using mollysocket with docker.

When I try to add a connection, the CLI tells me that it's successfully added:

# docker-compose run mollysocket connection add some-uuid 2 barfoo 'https://ntfy.sh/foobar?up=1' websocket
[2023-11-29T21:06:00Z DEBUG mollysocket::config] Config file: /data/ms.toml
Connection for some-uuid added.

However, when I list the connections, it's completely empty:

# docker-compose run mollysocket connection list
[2023-11-29T21:06:03Z DEBUG mollysocket::config] Config file: /data/ms.toml

When I watch https://ntfy.sh/foobar in the browser, there are no messages pushed when I receive a message on Signal.

Logs of the startup:

mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch] Configured for release.
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] address: 0.0.0.0
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] port: 8050
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] workers: 8
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] max blocking threads: 512
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] ident: Rocket
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] IP header: X-Real-IP
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] limits: bytes = 8KiB, data-form = 2MiB, file = 1MiB, form = 32KiB, json = 1MiB, msgpack = 1MiB, string = 8KiB
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] temp dir: /tmp
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] http/2: true
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] keep-alive: 5s
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] tls: disabled
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] shutdown: ctrlc = true, force = true, signals = [SIGTERM], grace = 2s, mercy = 3s
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] log level: critical
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] cli colors: true
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch] Routes:
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] (discover) GET /
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] (register) POST / application/json
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] GET /metrics/
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch] Fairings:
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] Prometheus metric collection (request, response)
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::launch::_] Shield (liftoff, response, singleton)
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::shield::shield] Shield:
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::shield::shield::_] X-Frame-Options: SAMEORIGIN
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::shield::shield::_] Permissions-Policy: interest-cohort=()
mollysocket       | [2023-11-29T21:14:01Z INFO  rocket::shield::shield::_] X-Content-Type-Options: nosniff
mollysocket       | [2023-11-29T21:14:01Z WARN  rocket::launch] Rocket has launched from http://0.0.0.0:8050
mollysocket       | [2023-11-29T21:14:01Z DEBUG mollysocket::config] Config file: /data/ms.toml

Trying to add a connection doesn't produce additional entries in the log. Receiving messages doesn't produce additional entries in the log. Accessing the web interface with a browser works. It shows:

mollysocket 
version "1.1.1"

I can see this in the log:

mollysocket       | [2023-11-29T21:30:30Z DEBUG rocket::server] Received request: Request {
mollysocket       |         method: GET,
mollysocket       |         uri: /,
mollysocket       |         version: HTTP/1.1,
mollysocket       |         headers: {
mollysocket       |             "host": "10.10.10.10:8050",
mollysocket       |             "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0",
mollysocket       |             "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
mollysocket       |             "accept-language": "en-US;q=0.7,en;q=0.3",
mollysocket       |             "accept-encoding": "gzip, deflate",
mollysocket       |             "dnt": "1",
mollysocket       |             "connection": "keep-alive",
mollysocket       |             "upgrade-insecure-requests": "1",
mollysocket       |         },
mollysocket       |         body: Body(
mollysocket       |             Empty,
mollysocket       |         ),
mollysocket       |     }
mollysocket       | [2023-11-29T21:30:30Z INFO  rocket::server] GET / text/html:
mollysocket       | [2023-11-29T21:30:30Z INFO  rocket::server::_] Matched: (discover) GET /
mollysocket       | [2023-11-29T21:30:30Z INFO  rocket::server::_] Outcome: Success(200 OK)
mollysocket       | [2023-11-29T21:30:30Z DEBUG rocket::server] sending response: Response {
mollysocket       |         status: 200,
mollysocket       |         version: HTTP/1.1,
mollysocket       |         headers: {
mollysocket       |             "content-type": "application/json",
mollysocket       |             "server": "Rocket",
mollysocket       |             "x-frame-options": "SAMEORIGIN",
mollysocket       |             "permissions-policy": "interest-cohort=()",
mollysocket       |             "x-content-type-options": "nosniff",
mollysocket       |             "content-length": "35",
mollysocket       |         },
mollysocket       |         body: Body(
mollysocket       |             Streaming,
mollysocket       |         ),
mollysocket       |     }
mollysocket       | [2023-11-29T21:30:30Z INFO  rocket::server::_] Response succeeded.

Adding the connection via Molly on my phone doesn't work either, it tells me MollySocket server not found, even though I can access it (and see the json output with the version) via the browser on the phone. I can not see these connection attempts in the log.

My docker-compose.yml:

version: "3.7"

mollysocket:
    image: ghcr.io/mollyim/mollysocket:latest
    container_name: mollysocket
    restart: always
    volumes:
      - ./data:/data
    command: server
    environment:
      - MOLLY_CONF=/data/ms.toml
      - ROCKET_PORT=8050
      - ROCKET_ADDRESS=0.0.0.0
      - RUST_LOG=trace
    ports:
      - "8050:8050"
p1gp1g commented 9 months ago

Could you paste your ms.toml ?

Fr0d0Beutl1n commented 9 months ago

Sure:

environment = 'Prod'
allowed_endpoints = [
    'https://ntfy.sh/',
    'https://up.conversations.im/',
    'https://fcm.distributor.unifiedpush.org/',
    'https://mollysocket.my.domain',
]
allowed_uuids = ['*']
db = './mollysocket.db'
p1gp1g commented 9 months ago

Thanks, change ./mollysocket.db to /data/mollysocket.db.

BTW, allowed_endpoints contains the push endpoints, if you host your own distributor instance (for instance ntfy), then you should add it there, this is not the mollysocket endpoint. I'm saying this because you have https://mollysocket.my.domain and not https://ntfy.my.domain or https://push.etc or whatever

Fr0d0Beutl1n commented 9 months ago

Thanks! Now I can add devides. Is the default wrong? I didn't change it manually.

Maybe we should have an environment variable similar to MOLLY_CONF where the location of the database is specified. We could add that variable to docker-compose.yml, so that the default configuration works.

p1gp1g commented 9 months ago

That may be a good thing :+1: