oxen-io / session-pysogs

Python implementation of the Session community server
GNU General Public License v3.0
77 stars 36 forks source link

Is there a way to make a "one way" chat like session updates? #37

Open dillfrescott opened 2 years ago

dillfrescott commented 2 years ago

One where only admins/mods can chat in. For announcements and stuff.

jagerman commented 2 years ago

Yes, though Session doesn't yet have support for updating the newer pysogs room permissions. As a temporary measure, in pysogs you can use this query:

UPDATE rooms SET write = FALSE, upload = FALSE where token = 'some-room';

to disable the ability for regular users to post in the room. (Moderators/admins will still be allowed).

dillfrescott commented 2 years ago

@jagerman Thank you so much! Where do I enter this command?

jagerman commented 2 years ago

If this is a default sogs-standalone deb install then the database will be at /var/lib/session-open-group-server/sogs.db, and the sqlite3 command can be used interact with it (but be careful!):

sudo sqlite3 /var/lib/session-open-group-server/sogs.db
SQLite version 3.37.2 2022-01-06 13:25:41
Enter ".help" for usage hints.
sqlite> SELECT token, name, read, write, upload FROM rooms WHERE token = 'some-room';
some-room|Some Room!|1|1|1
sqlite> UPDATE rooms SET write = FALSE, upload = FALSE WHERE token = 'some-room';
sqlite> SELECT token, name, read, write, upload FROM rooms WHERE token = 'some-room';
some-room|Some Room!|1|0|0
sqlite> 

You'll need to change 'some-room' in those queries to whatever the room token is, of course.

(If you get a sqlite3: command not found error then you'll need to run: sudo apt install sqlite3 first to get the command-line sqlite interface).

dillfrescott commented 2 years ago

Thank you!!

mdPlusPlus commented 1 year ago

Can this be done through the the sogs utility yet?