wey-gu / chatroom-syncer

Sync IM Chat Room to the public domain like IRC
Apache License 2.0
44 stars 6 forks source link

feature: use custom avatar from wechat per msg #2

Open wey-gu opened 1 year ago

wey-gu commented 1 year ago

A avatar cache should be built to custom msg sender's profile image.

wey-gu commented 1 year ago

Now it's something like this:

Screenshot 2022-12-15 at 23 29 26
wey-gu commented 1 year ago

TBD:

frostming commented 1 year ago

support upload avatar to object storage with URL and pass to slack(seems to be the only way to specify avatar)

Disagree with introducing extra dependencies. I will try a serverless solution that generates the image URLs from the base64 data. Something like:

https://make-image.serverless.app/${base64}
wey-gu commented 1 year ago

support upload avatar to object storage with URL and pass to slack(seems to be the only way to specify avatar)

Disagree with introducing extra dependencies. I will try a serverless solution that generates the image URLs from the base64 data. Something like:

https://make-image.serverless.app/${base64}

ok, this..., to put image in URL/base64 blew my mind 🤯!!!! It's totally next level🧎🏻...

frostming commented 1 year ago

support upload avatar to object storage with URL and pass to slack(seems to be the only way to specify avatar)

Disagree with introducing extra dependencies. I will try a serverless solution that generates the image URLs from the base64 data. Something like:

https://make-image.serverless.app/${base64}

ok, this..., to put image in URL/base64 blew my mind 🤯!!!! It's totally next level🧎🏻...

Indeed it has been worked out with CF worker(yeah, THANKS TO ChatGPT), try visiting this URL. I am currently stuck by not able to get the contact avatar..

P.S. the API spec is:

https://mkimg.frostming.workers.dev/${base64_url_encoded}.${ext}
wey-gu commented 1 year ago

Aha, my regular expression was written by ChatGPT, too :P

It worked like a charm! I am not familiar with the price model of CF worker, as it will require CF's edge computing resource to decode and respond with those small images, will this be scaling to anyone? (that is, we can place your single CF-worker-based endpoint by default to expect it will work for long? or do we need users to setup their own avatar base64 ping-pong service same as yours?

Screenshot 2022-12-16 at 15 32 10

frostming commented 1 year ago

I am currently stuck by not able to get the contact avatar..

Reported to wechaty: https://github.com/wechaty/python-wechaty/issues/381

wey-gu commented 1 year ago

I am currently stuck by not able to get the contact avatar..

Reported to wechaty: wechaty/python-wechaty#381

Oh, I encountered this, too, this is hard as python lib is just a wrapper and the gateway is the major part(hard for me to debug) :(

anyway, I will look into it later, too, I have to prepare for the slides of tomorrow now 🤦🏻‍♀️.

frostming commented 1 year ago

Indeed, but the error message argument of type 'NoneType' is not iterable indicates that it may come from Python code. Let's see.

wey-gu commented 1 year ago

@frostming If the ContactAvatarResponse, and ContactAvatarRequest gRPC interface issue cannot be mitigated anyway, we could still leverage your CF worker URL encoded magic to add our customized avatars :)

frostming commented 1 year ago

@frostming If the ContactAvatarResponse, and ContactAvatarRequest gRPC interface issue cannot be mitigated anyway, we could still leverage your CF worker URL encoded magic to add our customized avatars :)

I came up with an EVIL approach to fix the issue in a DIRTY way, let me check.

wey-gu commented 1 year ago

Wow, this sounds neat...😏