在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mbilokonsky/ambassador开源软件地址(OpenSource Url):https://github.com/mbilokonsky/ambassador开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):Ambassador BotThis is my attempt to fix the problem of followbots on Mastodon, while also adding some potentially useful and interesting behavior to a bot that can be run on any server. The AmbassadorBot will live on your server and find those local toots that have earned a high number of favs relative to other local toots. It will then boost them. The idea is that it's always boosting the 'best' toots of the instance that it run on. Anyone who follows your instance's Ambassador will therefore get the best toots of your interest in their federated feed. No need to use followbots to systematically follow users when you can get the best of their toots easily! Furthermore, I'd love it if the idea of ambassadors caught on independently of this bot. This is my first attempt to implement the idea - it's a proof of concept I threw together in a few hours. It has exactly one setting, which is the query I documented below. It doesn't, right now, even make any attempt to keep private toots private, or respect #nobot, or anything like that - these are all features that will come. But there's no reason some instances couldn't have human ambassadors! Or couldn't just find a way to publish every single public toot! Or provide a random sample! The thinking behind this is really: wouldn't it be great to give communities a way to represent themselves to the world? Where they have some say in how their community projects itself? This is my attempt to start that conversation, and I'd very much love all of your feedback! :) InstallationThis bot has to be installed on your instance server, so unless you're the admin you're not going to be able to set it up yourself. The reason for that is that the bot reads directly from your database, rather than using the API. Mastodon account for the ambassador botFirst, you'll need to create a new account on your instance and use the @tinysubversions extractor to get an OAuth token for it. Creating a UNIX user for ambassadorRunning ambassador as the same user as Mastodon (or worse,
While you are logged-in as ambassador, you can clone the source repository for it:
Note: Ideally, ambassador should not get R/W access to its own sources. However, best practices for deploying software on servers falls outside the scope of this README. Creating a database user for ambassadorTo avoid a whole host of security issues, So you have to start by creating the view and the PostgreSQL user for
Note that the default setup assumes that:
If that's not the case, you can always use password authentication instead. Running ambassadorIt requires the following environment variables (and uses the provided defaults when they're missing):
As user
It'll cycle every 15 minutes, boosting new toots that have crossed the threshold. It keeps track, in memory, of which toots have already been boosted - that way it won't spam the server trying to boost them again and again. How does it determine what's good enough to boost?So, this is still sort of an open question but right now I'm using the following query:
So we do two things here:
Goal here is that this sets a pretty high bar (favs over 30 days) and applies it to only the past 5 days. It's an aggressive filter, but it's also a sliding window. If you have a bunch of super popular toots on your instance, they'll skew the curve - but only for a month or so, and this will be normalized if you have a lot of activity. Generally things will even out over time. I am not, btw, a database expert - I pieced this query together through trial-and-error and if you want to propose an optimization I am all ears. Seriously? You want me to give this thing access to my production database?Ambassador only gets access to public toots (through the The direct database access is required to find top toots efficiently. What's next? Can I help?I'd love it if I could get some eyes on this - am I SQLing right? How do y'all feel about that threshold function? Are there security issues here? Where is it running? |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论