Compare commits

..

No commits in common. "4c0f2346d8ae2cd761c28f1eef4729b95b563445" and "1a7a11eaf340b43b14ad2ccb47107a6a3980353e" have entirely different histories.

8 changed files with 18 additions and 21 deletions

View File

@ -18,12 +18,11 @@
* [ ] Message reactions * [ ] Message reactions
* [x] Read receipts * [x] Read receipts
* [x] Power level<sup>[1]</sup> * [x] Power level<sup>[1]</sup>
* [ ] Membership actions * [ ] Membership actions<sup>[3]</sup>
* [ ] Invite
* [ ] Join * [ ] Join
* [x] Leave<sup>[3]</sup> * [x] Leave<sup>[4]</sup>
* [ ] Ban<sup>[4]</sup> * [ ] Ban<sup>[5]</sup>
* [ ] Unban<sup>[4]</sup> * [ ] Unban<sup>[5]</sup>
* [ ] Room metadata changes<sup>[1]</sup> * [ ] Room metadata changes<sup>[1]</sup>
* [x] Name * [x] Name
* [x] Topic * [x] Topic
@ -52,18 +51,17 @@
* [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>[4]</sup> * [x] Kick<sup>[5]</sup>
* [x] Unkick<sup>[4]</sup> * [x] Unkick<sup>[5]</sup>
* [ ] Channel metadata * [ ] Channel metadata
* [x] Name * [x] Name
* [x] Description * [x] Description
* [x] Cover photo<sup>[5]</sup> * [x] Cover photo<sup>[6]</sup>
* [ ] User metadata * [ ] User metadata
* [x] Name * [x] Name
* [x] Avatar * [x] Avatar
@ -83,6 +81,7 @@
<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> 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>[3]</sup> KakaoTalk does not support invites
<sup>[4]</sup> Kicks in KakaoTalk are equivalent to bans in Matrix <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>[5]</sup> Might only get synced on backfill, or on changing channel name/description <sup>[5]</sup> Kicks in KakaoTalk are equivalent to bans in Matrix
<sup>[6]</sup> Might only get synced on backfill, or on changing channel name/description

View File

@ -56,11 +56,10 @@ 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/link the bridge & node-kakao module configuration files to the services' configuration directory as `config.yaml` and `node-config.json`, respectively 1. Copy 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.2.0" __version__ = "0.1.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, evolve from attr import dataclass
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 = evolve(orig_power_levels) power_levels = PowerLevelStateEventContent(**orig_power_levels.serialize())
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 = evolve(orig_power_levels) power_levels = PowerLevelStateEventContent(**orig_power_levels.serialize())
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 await channelList.leaveChannel({ channelId: req.channel_props.id }) return channelList.leaveChannel({ channelId: req.channel_props.id })
} }
handleUnknownCommand = () => { handleUnknownCommand = () => {

View File

@ -63,6 +63,7 @@ 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,7 +9,6 @@ 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,7 +7,6 @@ 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