Some tweaks and comments

This commit is contained in:
Andrew Ferrazzutti 2021-02-20 03:48:08 -05:00
parent eb0f37274c
commit ec081e94df
4 changed files with 13 additions and 7 deletions

View File

@ -73,7 +73,8 @@ async def login_do(evt: CommandEvent, gen: AsyncGenerator[Tuple[str, str], None]
qr_event_id = await evt.az.intent.send_message(evt.room_id, content)
elif item[0] == "pin":
pin = item[1]
content = TextMessageEventContent(body=pin, msgtype=MessageType.NOTICE)
message = f"Enter this PIN in LINE on your primary device:\n{pin}"
content = TextMessageEventContent(body=message, msgtype=MessageType.NOTICE)
if pin_event_id:
content.set_edit(pin_event_id)
await evt.az.intent.send_message(evt.room_id, content)

View File

@ -108,7 +108,7 @@ export default class Client {
}
sendQRCode(url) {
this.log("Sending QR", url, "to client")
this.log(`Sending QR ${url} to client`)
return this._write({
id: --this.notificationID,
command: "qr",
@ -126,7 +126,7 @@ export default class Client {
}
sendFailure(reason) {
this.log(`Sending failure "${reason}" to client`)
this.log(`Sending failure to client${reason ? `: "${reason}"` : ""}`)
return this._write({
id: --this.notificationID,
command: "failure",

View File

@ -227,6 +227,7 @@ class MautrixController {
*/
parseParticipantList(element) {
// TODO Slice to exclude first member, which is always yourself (right?)
// TODO Only slice if double-puppeting is enabled!
//return Array.from(element.children).slice(1).map(child => {
return Array.from(element.children).map(child => {
return {
@ -444,7 +445,7 @@ class MautrixController {
for (const change of changes) {
for (const node of change.addedNodes) {
const emailArea = node.querySelector("#login_email_area")
if (emailArea && !emailArea.getAttribute("class").includes("MdNonDisp")) {
if (emailArea && !emailArea.classList.contains("MdNonDisp")) {
window.__mautrixSendEmailCredentials()
return
}
@ -496,7 +497,7 @@ class MautrixController {
}
const button = element.querySelector("dialog button")
this.expiryObserver = new MutationObserver(changes => {
if (changes.length == 1 && !changes[0].target.getAttribute("class").includes("MdNonDisp")) {
if (changes.length == 1 && !changes[0].target.classList.contains("MdNonDisp")) {
window.__mautrixExpiry(button)
}
})

View File

@ -434,6 +434,11 @@ export default class MessagesPuppeteer {
let participants
const participantList = await chatDetailArea.$("ul.mdRGT13Ul")
if (participantList) {
// TODO Use "id" syntax to tell if this is a chat/room/group, not selectors:
// c: group
// r: room
// u: chat
// It's defined by the LINE API!
if (await chatDetailArea.$("#leaveGroup")) {
this.log("Found group")
// This is a *group* (like a Matrix room)
@ -461,7 +466,6 @@ export default class MessagesPuppeteer {
// TODO Or just look up the member ID in the contact list?
}
this.log(`Found participants: ${participants}`)
return {
participants,
...await this.page.$eval(this._listItemSelector(id),
@ -575,7 +579,7 @@ export default class MessagesPuppeteer {
_receivePIN(pin) {
if (this.client) {
this.client.sendPIN(`Your PIN is: ${pin}`).catch(err =>
this.client.sendPIN(pin).catch(err =>
this.error("Failed to send new PIN to client:", err))
} else {
this.log("No client connected, not sending new PIN")