GithubHelp home page GithubHelp logo

mollyim / mollysocket Goto Github PK

View Code? Open in Web Editor NEW
82.0 82.0 8.0 274 KB

MollySocket allows getting Signal notifications via UnifiedPush.

License: GNU Affero General Public License v3.0

Dockerfile 0.39% Rust 99.61%

mollysocket's People

Contributors

cal-andrew avatar dnut avatar genofire avatar loveisgrief avatar networkexception avatar p1gp1g avatar pimlie avatar reportingissue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mollysocket's Issues

1.3.0 docker image release seems to be only armv7

I tried updating my mollysocket docker-compose based install and mollysocket wouldn’t start after pulling latest.

I saw this error on the command line when trying to bring up the container:

mollysocket The requested image's platform (linux/arm/v7) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested 0.0s
canceled

Then I looked at the releases listed here: https://ghcr.io/mollyim/mollysocket and it looks like prior releases have 4 architectures available but the latest (1.3.0) doesn’t have an Arch tab on its release details…

SCR-20240324-jpca SCR-20240324-jphx

[bug] InternalError returns instead of InvalidEndpoint

I have set up my own MollySocket webserver using Docker using the default configuration. I manage my Docker containers with Portainer and have setup a reverse proxy (NGINX) on the same server to access the MollySocket webserver from outside my network via https://MY-DOMAIN.COM. When I access the MollySocket webserver via browser (http://INTERNAL-PORTAINER-IP:8020/ OR https://MY-DOMAIN.COM/), it shows

{"mollysocket":{"version":"1.0.0"}}

I have set up the latest UnifiedPush version of Molly from its F-Droid repo (v6.35.3-1.up2-FOSS), used https://MY-DOMAIN.COM/ as server URL and it shows a check mark next to it. Nevertheless, it shows the above mentioned error message ("An internal Error occured, please try again") under "Status".

My guess is that I haven't set up my ms.toml file correctly, thus causing the error.

Below my ms.toml file:

environment = Prod
allowed_endpoints = ['http://0.0.0.0/','http://0.0.0.0:8020/','http://INTERNAL-PORTAINER-IP:8020/','https://MY-DOMAIN.COM/']
allowed_uuids = ['*']
db = './mollysocket.db'

Using

allowed_endpoints = ['*']

results in the same error. Maybe I haven't specified my internal endpoints correctly as stated in the Readme file?

Any help would be appreciated.

Notifications not going through to nfty

I have a self-hosted ntfy server on my internal network (192.168.x.x) dnsmasq'ed to debian.apmac.us. I had this same issue with ntfy.sh server. I registered mollysocket like below, and the app says the connection is fine.

$ mollysocket connection list
[....cargo/registry/src/index.crates.io-6f17d22bba15001f/mollysocket-1.2.0/src/cli/connection.rs:75] &connection = Connection {
    uuid: "....",
    device_id: 2,
    password: "....",
    endpoint: "http://debian.apmac.us:8040/9123id9e7dh?up=1",
    forbidden: false,
    last_registration: OptTime(
        None,
    ),
}

Notifications work fine when done with curl or similar to a test url. If I try to curl -d hello http://debian.apmac.us:8040/9123id9e7dh?up=1 doesn't work (note the url is fake here, but I correctly copied it when I tested it), but I imagine this is because it requires a notification from molly.

DEBUG logs from Molly show signal notifications coming through, but maybe they aren't able to forward on to ntfy. There aren't any errors anywhere.

[2023-12-23T21:22:02Z INFO  mollysocket::server::connections] Starting connection for .......
[2023-12-23T21:22:03Z DEBUG tungstenite::handshake::client] Client handshake done.
[2023-12-23T21:22:03Z INFO  mollysocket::ws::websocket_connection] WebSocket handshake has been successfully completed

....

[2023-12-23T21:27:35Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:35Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:27:36Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:36Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:27:40Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:40Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:27:40Z DEBUG mollysocket::ws::signalwebsocket] Sending the notification.
[2023-12-23T21:27:40Z DEBUG reqwest::connect] starting new connection: http://debian.apmac.us:8040/
[2023-12-23T21:27:42Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:42Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::websocket_connection] Sending Keepalive
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::websocket_connection] send_keepalive
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::signalwebsocket] New response
[2023-12-23T21:28:33Z DEBUG mollysocket::ws::websocket_connection] Sending Keepalive

I checked the ntfy server cache and there is nothing from mollysocket

What means: Failed to decode protobuf?

after some hours of running mollysocket (as container in portainer) i found in the logs this error:
.
.
.
[2023-12-20T13:30:11Z INFO mollysocket::ws::websocket_connection] WebSocket handshake has been successfully completed
[2023-12-20T13:36:07Z INFO rocket::server] GET / text/html:
[2023-12-20T13:36:07Z INFO rocket::server::] Matched: (discover) GET /
[2023-12-20T13:36:07Z INFO rocket::server::
] Outcome: Success(200 OK)
[2023-12-20T13:36:07Z INFO rocket::server::_] Response succeeded.
[2023-12-20T20:27:34Z ERROR mollysocket::ws::websocket_connection] Failed to decode protobuf: failed to decode Protobuf message: invalid wire type value: 7
[2023-12-20T20:27:34Z WARN mollysocket::ws::websocket_connection] Websocket finished
[2023-12-20T20:27:34Z INFO mollysocket::ws::signalwebsocket] Retrying to connect in 10 secondes.
[2023-12-20T20:27:44Z INFO mollysocket::ws::websocket_connection] WebSocket handshake has been successfully completed
[2023-12-20T20:43:34Z ERROR mollysocket::ws::websocket_connection] Failed to decode protobuf: failed to decode Protobuf message: invalid wire type value: 7
[2023-12-20T20:43:34Z WARN mollysocket::ws::websocket_connection] Websocket finished
.
.
.
.

after restart the container the error has gone for now...

I couldn't find any meaningful information about this error on the internet

Thank you very much

How to setup mollysocket with mollyim-android-unifiedpush

Hey I am trying to use mollysocket to use unified push with mollyim-android-unifiedpush.

So far i launched the docker-compose file on a rasperry pi 4

I edited, the docker-compose.yml
to update the
MOLLY_ALLOWED_UUIDS with the one which is showing in the android app
MOLLY_ALLOWED_ENDPOINTS with the ntfy.sh/sometopic url which was showing in the ntfy.sh app

mollysocket is available from the internet with some url like this http://my.tl.d:8020/

What am I doing wrong?
Do I need to update the docker config or is something else missing?

Air gapped mode: "push might break"

In server/web.rs I see this message:

The web server is disabled, making mollysocket run in an air gapped mode. With this clients are less easy to set up and push might break.

I understand clients are less easy to set up, but could you explain "push might break?" Is there some condition that may prevent push messages from being delivered as reliably as in the normal mode?

Context: I'm investigating this issue, trying to find reasons why a person might need to restart the server after adding a connection.

Setup with Docker compose

Is there a docker compose available for this software? I'm looking to self host but I don't understand how to write my own docker compose.

I am hoping to deploy this with docker and watchtower so that it can be automaticlly updated.

You may have new messages

Since using mollysocket for notifications rather than WebSocket, sometimes I get a Molly notification saying "You may have new messages" instead of the actual message. Happens about 50% of the time.

Im assuming this has something to do with my phone blocking Molly from connecting to the internet in the background upon being awoken by ntfy, however it only happens sometimes, and I've tried Molly with Optimized, and Unrestricted battery settings on my GrapheneOS pixel and I get the same notifications.

Does anyone know the reason for this? Or how I can work around it?

Install failed

Tried to install mollysocket; got this error:

$ cargo install mollysocket Updating crates.io index Downloaded mollysocket v1.2.0 error: failed to parse manifest at´ /opt/mollysocket/.cargo/registry/src/github.com-1ecc6299db9ec823/mollysocket-1.2.0/Cargo.toml´
Caused by: invalid type: unit variant, expected string only for key´ profile.release.strip

how to solve this? I'm trying this on a dietpi Debian GNU/Linux 11 (bullseye) x86_64

Provide MUSl builds

Self-explanatory; my server is a 2014 Motorola and I really don't have the time to wait for it to compile

Are self-signed certificates supported?

The readme says:

You must configure TLS with a reverse proxy in front of MollySocket. Molly can only connect to the server over HTTPS.

But should self-signed certificates be supported? Cause it seems they are not.

Im using caddy's tls internal option as my server is not publicly accessible and in my browser I get a response {"mollysocket":{"version":"1.2.0"}} after having confirmed the security warning about the self-signed certificate.

But in molly I keep getting the error MollySocket server not found. After enabling debug logs in caddy I see the following error logged:

DBG ts=n.n logger=http.stdlib msg=http: TLS handshake error from x.x.x.x:yyyy: remote error: tls: unknown certificate

So I guess that's because molly doesn't trust the self-signed certificate? Is there any way to resolve this, preferably without having to install caddy's self-created CA root on my phone?

How to setup air-gapped mode with Docker

Hey,

I'm trying to follow INSTALL.md instructions with my Docker container. I want to use air gapped mode, so I don't have to expose another service to the internet, however I'm unsure of how to run the connection add command on the container. When I open bash inside the container there's no /opt/mollysocket folder, and I cannot switch to user mollysocket.

Thanks!

Installation with cargo gives me an error

Hi,
i try to setup my own server on my raspberry pi 4. cargo install mollysocket gives me this error.

error: failed to download mollysocket v1.1.1

Caused by:
unable to get packages from source

Caused by:
failed to parse manifest at /opt/mollysocket/.cargo/registry/src/github.com-1ecc6299db9ec823/mollysocket-1.1.1/Cargo.toml

Caused by:
invalid type: unit variant, expected string only for key profile.release.strip

Documentation incomplete

Under the heading Configuration, there seems to be an incomplete sentence:

It is possible to use MollySocket without the web server: see the Air Gapped mode on Android settings. In this mode MollySocket doesn't

In this mode Mollysocket doesn't ... I would like to know what it doesn't 😅.

Syncing on Desktop App(s) dont work properly

since i have mollyim-android-unifiedpush and mollysocket running on my primary deice, i'm notice that in some cases messages are not syncing properly to my linked Desktop app(s) (windows and macOS). Messages from the other side im chatting are arriving normal.
Other thing is that on desktop app(s) im not able to pin "Note to self" in the contact list on the left side.

raspberry pi installation

hello and thanks for bringing all that work, I wanted to try mollysocket for limiting battery drain on my phone.

I tried the installation on my raspberry, unfortunately compiling failed, I have a rpi 3B+, surely that's not next gen and maybe this is causing the crashes.
Compiling crashed on both 64 and 32bits versions of raspberry pi os lite. At the very end for 32bits.
This is when it crash : "Building [=======================> ] 324/325: mollysocket(bin)

I was not able to make it work with docker, my skills are quite limited, after some tests I sticked to the readme file for cargo but ended with the compilation crash.

If you have a tip on trying something differently that'd be nice, and thanks again for all the work.

How does mollysocket fit into the unified push architecture?

https://unifiedpush.org/ defines 4 components: application server, push server, distributor app, phone application

image

The application server pushes notifications to the push server, which pushes those to the distributor app, which in turn wakes up the phone application to deliver the data (at least that's how I understand the flow).

Where does MollySocket come in? Is it a mandatory component?

It would be nice if this information were in the README.

Improve the quality of log messages

Problem

I recently installed the server, and had issues with the config (#11), because I specified a wrong database location (?). To be honest, I don't really know what exactly was the issue.

Unfortunately, the log messages didn't really help troubleshooting, and were a bit misleading. When I tried adding a connection, the log message told me, that the connection was successfully added, even though it was not.

Proposed Solution

  • At startup, check whether the database works, and initate a crash in case it doesn't
  • When accessing the database, print a log message with details about the success of the operation

Can't register AirGapped MolleySocket

In the INSTALL.md, it says,

You will have to switch on air gapped mode on Molly (Android). It will have a command to copy to run on your server. You must run this command as user mollysocket with MOLLY_CONF=/opt/mollysocket/prod.toml.

I imagine the command should be something like this,

$ mollysocket connection add
error: the following required arguments were not provided:
  <ACCOUNT_ID>
  <DEVICE_ID>
  <PASSWORD>
  <ENDPOINT>

Usage: mollysocket connection add <ACCOUNT_ID> <DEVICE_ID> <PASSWORD> <ENDPOINT>

I have the UP version of Molly installed from F-Droid. Under Settings => Notifications => UnifiedPush, if I click Air gapped,

  • the Account ID option disappears.
  • Server parameters simply allows me to copy, but says "No device"
  • Status says "Cannot create the linked device".

What do I do?

Adding connections doesn't work

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"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.