add tests, implement kstate and state diffing

This commit is contained in:
Cadence Ember 2023-05-05 17:29:08 +12:00
parent c7868e9dbb
commit f09eeccef3
10 changed files with 2656 additions and 64 deletions

View file

@ -1,6 +1,6 @@
// @ts-check
const fetch = require("node-fetch")
const fetch = require("node-fetch").default
const passthrough = require("../passthrough")
const { sync, db } = passthrough
@ -33,7 +33,6 @@ async function uploadDiscordFileToMxc(path) {
// Download from Discord
const promise = fetch(url, {}).then(/** @param {import("node-fetch").Response} res */ async res => {
/** @ts-ignore @type {import("stream").Readable} body */
const body = res.body
// Upload to Matrix
@ -56,7 +55,7 @@ async function uploadDiscordFileToMxc(path) {
}
function guildIcon(guild) {
return `/icons/${guild.id}/${guild.icon}?size=${IMAGE_SIZE}`
return `/icons/${guild.id}/${guild.icon}.png?size=${IMAGE_SIZE}`
}
module.exports.guildIcon = guildIcon