Compare commits

..

5 Commits

Author SHA1 Message Date
4c0f2346d8 Update version 2022-04-29 09:55:53 -04:00
9e8541772d Update roadmap to remove claim about KT not supporting invites
node-kakao supports sending invites, so KT must have them after all
2022-04-29 02:06:28 -04:00
18ba4707ab Add missing await in leave command 2022-04-29 01:28:15 -04:00
b7df79e65d Copy PL state events with evolve 2022-04-28 22:28:39 -04:00
780dbed7c2 Set group ownership of systemd service config dir
Also mention that linking to config files is possible
2022-04-28 22:26:33 -04:00
8 changed files with 21 additions and 18 deletions

View File

@ -18,11 +18,12 @@
* [ ] Message reactions * [ ] Message reactions
* [x] Read receipts * [x] Read receipts
* [x] Power level<sup>[1]</sup> * [x] Power level<sup>[1]</sup>
* [ ] Membership actions<sup>[3]</sup> * [ ] Membership actions
* [ ] Invite
* [ ] Join * [ ] Join
* [x] Leave<sup>[4]</sup> * [x] Leave<sup>[3]</sup>
* [ ] Ban<sup>[5]</sup> * [ ] Ban<sup>[4]</sup>
* [ ] Unban<sup>[5]</sup> * [ ] Unban<sup>[4]</sup>
* [ ] Room metadata changes<sup>[1]</sup> * [ ] Room metadata changes<sup>[1]</sup>
* [x] Name * [x] Name
* [x] Topic * [x] Topic
@ -51,17 +52,18 @@
* [x] On live event * [x] On live event
* [x] Admin status * [x] Admin status
* [ ] Membership actions * [ ] Membership actions
* [ ] Invite
* [x] Join * [x] Join
* [x] Leave * [x] Leave
* [ ] Self leave * [ ] Self leave
* [ ] On backfill * [ ] On backfill
* [x] On live event * [x] On live event
* [x] Kick<sup>[5]</sup> * [x] Kick<sup>[4]</sup>
* [x] Unkick<sup>[5]</sup> * [x] Unkick<sup>[4]</sup>
* [ ] Channel metadata * [ ] Channel metadata
* [x] Name * [x] Name
* [x] Description * [x] Description
* [x] Cover photo<sup>[6]</sup> * [x] Cover photo<sup>[5]</sup>
* [ ] User metadata * [ ] User metadata
* [x] Name * [x] Name
* [x] Avatar * [x] Avatar
@ -81,7 +83,6 @@
<sup>[1]</sup> Sometimes fails with "Invalid body" error <sup>[1]</sup> Sometimes fails with "Invalid body" error
<sup>[2]</sup> Only recently-sent KakaoTalk messages can be deleted <sup>[2]</sup> Only recently-sent KakaoTalk messages can be deleted
<sup>[3]</sup> KakaoTalk does not support invites <sup>[3]</sup> To make your KakaoTalk account leave a channel, send the `leave` command in a Matrix portal room. Simply leaving a Matrix portal room will keep your KakaoTalk account in the channel.
<sup>[4]</sup> To make your KakaoTalk account leave a channel, send the `leave` command in a Matrix portal room. Simply leaving a Matrix portal room will keep your KakaoTalk account in the channel. <sup>[4]</sup> Kicks in KakaoTalk are equivalent to bans in Matrix
<sup>[5]</sup> Kicks in KakaoTalk are equivalent to bans in Matrix <sup>[5]</sup> Might only get synced on backfill, or on changing channel name/description
<sup>[6]</sup> Might only get synced on backfill, or on changing channel name/description

View File

@ -56,10 +56,11 @@ To use them as-is, follow these steps after [initial setup](#initial-setup):
1. Copy/link the service files to a directory in the system unit search path, such as `/etc/systemd/system/` 1. Copy/link the service files to a directory in the system unit search path, such as `/etc/systemd/system/`
1. Create the services' configuration directory with `sudo mkdir /etc/matrix-appservice-kakaotalk` 1. Create the services' configuration directory with `sudo mkdir /etc/matrix-appservice-kakaotalk`
1. RECOMMENDED: Create the `matrix-appservice-kakaotalk` user on your system with `adduser` or an equivalent command, then uncomment the `User` and `Group` lines in the service files 1. RECOMMENDED: Create the `matrix-appservice-kakaotalk` user on your system with `adduser` or an equivalent command, then uncomment the `User` and `Group` lines in the service files
* If creating this user, also give it write permissions on the services' configuration directory with `chgrp matrix-appservice-kakaotalk /etc/matrix-appservice-kakaotalk && chmod g+w /etc/matrix-appservice-kakaotalk`
* To install as user units: * To install as user units:
1. Copy/link the service files to a directory in the user unit search path, such as `~/.config/systemd/user` 1. Copy/link the service files to a directory in the user unit search path, such as `~/.config/systemd/user`
1. Create the services' configuration directory with `mkdir $XDG_CONFIG_HOME/matrix-appservice-kakaotalk` 1. Create the services' configuration directory with `mkdir $XDG_CONFIG_HOME/matrix-appservice-kakaotalk`
1. Copy the bridge & node-kakao module configuration files to the services' configuration directory as `config.yaml` and `node-config.json`, respectively 1. Copy/link the bridge & node-kakao module configuration files to the services' configuration directory as `config.yaml` and `node-config.json`, respectively
1. Start the services now and on every boot boot with `[sudo] systemd [--user] enable --now matrix-appservice-kakaotalk{,-node}` 1. Start the services now and on every boot boot with `[sudo] systemd [--user] enable --now matrix-appservice-kakaotalk{,-node}`
## Upgrading ## Upgrading

View File

@ -1,2 +1,2 @@
__version__ = "0.1.0" __version__ = "0.2.0"
__author__ = "Andrew Ferrazzutti <fair@miscworks.net>" __author__ = "Andrew Ferrazzutti <fair@miscworks.net>"

View File

@ -33,7 +33,7 @@ import asyncio
import re import re
import time import time
from attr import dataclass from attr import dataclass, evolve
from mautrix.appservice import IntentAPI from mautrix.appservice import IntentAPI
from mautrix.bridge import BasePortal, NotificationDisabler, async_getter_lock from mautrix.bridge import BasePortal, NotificationDisabler, async_getter_lock
@ -420,7 +420,7 @@ class Portal(DBPortal, BasePortal):
sender_intent = sender.intent_for(self) if sender else self.main_intent sender_intent = sender.intent_for(self) if sender else self.main_intent
admin_level = orig_power_levels.get_user_level(sender_intent.mxid) admin_level = orig_power_levels.get_user_level(sender_intent.mxid)
demoter_ids: list[UserID] = [] demoter_ids: list[UserID] = []
power_levels = PowerLevelStateEventContent(**orig_power_levels.serialize()) power_levels = evolve(orig_power_levels)
for user_id, new_level in user_power_levels.items(): for user_id, new_level in user_power_levels.items():
curr_level = orig_power_levels.get_user_level(user_id) curr_level = orig_power_levels.get_user_level(user_id)
if curr_level < admin_level or user_id == sender_intent.mxid: if curr_level < admin_level or user_id == sender_intent.mxid:
@ -436,7 +436,7 @@ class Portal(DBPortal, BasePortal):
except: except:
self.log.exception("Failed to set power level") self.log.exception("Failed to set power level")
if demoter_ids: if demoter_ids:
power_levels = PowerLevelStateEventContent(**orig_power_levels.serialize()) power_levels = evolve(orig_power_levels)
for demoter_id in demoter_ids: for demoter_id in demoter_ids:
power_levels.set_user_level(demoter_id, user_power_levels[demoter_id]) power_levels.set_user_level(demoter_id, user_power_levels[demoter_id])
try: try:

View File

@ -1009,7 +1009,7 @@ export default class PeerClient {
userClient.talkClient.channelList, userClient.talkClient.channelList,
req.channel_props.type req.channel_props.type
) )
return channelList.leaveChannel({ channelId: req.channel_props.id }) return await channelList.leaveChannel({ channelId: req.channel_props.id })
} }
handleUnknownCommand = () => { handleUnknownCommand = () => {

View File

@ -63,7 +63,6 @@ setuptools.setup(
], ],
package_data={ package_data={
"matrix_appservice_kakaotalk": ["example-config.yaml"], "matrix_appservice_kakaotalk": ["example-config.yaml"],
"matrix_appservice_kakaotalk.web": ["static/*", "static/**/*"],
}, },
data_files=[ data_files=[
(".", ["matrix_appservice_kakaotalk/example-config.yaml"]), (".", ["matrix_appservice_kakaotalk/example-config.yaml"]),

View File

@ -9,6 +9,7 @@ Type=notify
NotifyAccess=all NotifyAccess=all
WorkingDirectory=/opt/matrix-appservice-kakaotalk/node WorkingDirectory=/opt/matrix-appservice-kakaotalk/node
ConfigurationDirectory=matrix-appservice-kakaotalk ConfigurationDirectory=matrix-appservice-kakaotalk
ConfigurationDirectoryMode=775
RuntimeDirectory=matrix-appservice-kakaotalk RuntimeDirectory=matrix-appservice-kakaotalk
RuntimeDirectoryPreserve=yes RuntimeDirectoryPreserve=yes
ExecStart=/usr/bin/env node src/main.js --config ${CONFIGURATION_DIRECTORY}/node-config.json ExecStart=/usr/bin/env node src/main.js --config ${CONFIGURATION_DIRECTORY}/node-config.json

View File

@ -7,6 +7,7 @@ After=multi-user.target network.target
; Group=matrix-appservice-kakaotalk ; Group=matrix-appservice-kakaotalk
WorkingDirectory=/opt/matrix-appservice-kakaotalk WorkingDirectory=/opt/matrix-appservice-kakaotalk
ConfigurationDirectory=matrix-appservice-kakaotalk ConfigurationDirectory=matrix-appservice-kakaotalk
ConfigurationDirectoryMode=775
RuntimeDirectory=matrix-appservice-kakaotalk RuntimeDirectory=matrix-appservice-kakaotalk
RuntimeDirectoryPreserve=yes RuntimeDirectoryPreserve=yes
ExecStart=/opt/matrix-appservice-kakaotalk/.venv/bin/python -m matrix_appservice_kakaotalk -c ${CONFIGURATION_DIRECTORY}/config.yaml ExecStart=/opt/matrix-appservice-kakaotalk/.venv/bin/python -m matrix_appservice_kakaotalk -c ${CONFIGURATION_DIRECTORY}/config.yaml