Title: Page 19 – Alex Kirk

---

 * 
   ## 󠀁[Mastodon API Tester](https://alex.kirk.at/2024/01/04/mastodon-api-tester/)󠁿
   
 * January 4, 2024
 * tldr: Use the [Mastodon API Tester](https://akirk.github.io/mastodon-api-tester/)
   to play with the Client API of Mastodon.
 * I’ve created the WordPress plugin called [Enable Mastodon Apps](https://wordpress.org/plugins/enable-mastodon-apps/)
   which does a seemingly small but powerful thing: it enables you to access your
   WordPress blog using Mastodon apps like [Tusky](https://github.com/tuskyapp/Tusky/)
   or [Ivory](https://tapbots.com/ivory/). This can be used to browse your own blog
   and post to it. If you also have the [Friends plugin](https://wordpress.org/plugins/friends/)
   and the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/) installed,
   this will actually make your WordPress blog behave like a Mastodon instance.
 * It does this be re-implementing the [Mastodon API](https://docs.joinmastodon.org/api/)(
   unfortunately, Mastodon didn’t opt to implement the [ActivityPub client-server API](https://www.w3.org/TR/activitypub/#client-to-server-interactions)
   so this is not based on a standard) which can be tricky: it uses REST API endpoints
   in the (virtual) directories `/oauth` and `/api` which are so generic that they
   are prone to conflicts.
 * Additionally, although [the API is well documented](https://docs.joinmastodon.org/api/),
   many apps were created based on assumptions that are true for Mastodon itself(
   which caused a lot–sometimes hard to reproduce–of [issues for the plugin](https://docs.joinmastodon.org/api/)).
   For example, the id of a post or a user is defined as a string but many apps 
   crash when you put a non-number there. Or that a boosted toot needs to have a
   different id than the virtual “wrapping” toot (Ivory!). In such cases, apps would
   crash but work fine with Mastodon itself.
 * Even more complicated are interactions with other WordPress plugins. It can be
   hard to understand if the plugin is working correctly, if another plugin is interfering,
   the hosting provider acts quirky, or if the Mastodon app has an incompatibilty
   with my implementation.
 * Thus I have created a simple one-page JS app called [Mastodon API Tester](https://akirk.github.io/mastodon-api-tester/)
   hosted on Github pages ([source on Github](https://github.com/akirk/mastodon-api-tester)):
 * [[
 * I hope that this tool will help identify issues better in future, it can also
   be used with [GotoSocial](https://github.com/superseriousbusiness/gotosocial)
   or a “real” [Mastodon](https://github.com/mastodon/mastodon/) instance. Feel 
   free to [report issues](https://github.com/akirk/mastodon-api-tester) you might
   encounter.
 * PS: the [Enable Mastodon Apps plugin will be worked on at the Cloudfest Hackathon](https://hackathon.cloudfest.com/project/enable-mastodon-apps-for-wordpress-and-its-plugins/),
   thanks [Matthias Pfefferle](https://notiz.blog/) for taking the lead on this!(
   Unfortunately, I cannot make it there because [I’ll be speaking at WordCamp Asia in Taipei](https://asia.wordcamp.org/2024/speakers/)
   just the weekend before that.)
 * PPS: [Happy Birthday, Matt!](https://ma.tt/2024/01/birthday-gift/)
 * [Enable Mastodon Apps](https://alex.kirk.at/category/wordpress/enable-mastodon-apps/),
   [Open Web](https://alex.kirk.at/category/open-web/), [WordPress](https://alex.kirk.at/category/wordpress/)
 * [Mastodon](https://alex.kirk.at/tag/mastodon/)
 * 
   ## 󠀁[Prototype: Create a Website from a Screenshot and Refine It, All in the Browser](https://alex.kirk.at/2023/12/21/prototype-create-a-website-from-a-screenshot-and-refine-it-all-in-the-browser/)󠁿
   
 * December 21, 2023
 * I’ve been working on this experiment, combining [OpenAI’s `gpt-4-vision-preview`](https://platform.openai.com/docs/guides/vision)
   with [WordPress Playground](https://playground.wordpress.net/) to create a website
   based on a screenshot.
 * This follows on the heels of [Matt Mullenweg’s](https://ma.tt/) announcement 
   at the [2023 State of the Word](https://wordpress.org/news/2023/12/state-of-the-word-2023-recap/)
   that in 2024, the WordPress project wants to work on [Data Liberation](https://wordpress.org/data-liberation/).
 * While the typical approach to migrating data is to build importers for specific
   services, a truely universal migration could happen through screenshots. With
   AI vision this might now be in reach.
 * So I built this [prototype that combines a OpenAI-powered chat interface with WordPress Playground](https://akirk.github.io/website-liberator/).
   First a screenshot, a screen recording further down.
 * ![](https://alex.kirk.at/wp-content/uploads/sites/2/2023/12/website-liberation-
   screenshots-1024x563.png)
 * So this is only a start. The website somewhat resembles the screenshot but it’s
   far from being pixel perfect.
 * My idea is that you’ll work together with the assistant in refining the site.
   It can help you update, you can ask it questions. An import is rarely perfect
   from the start but you can see and test the result right away in the browser 
   and refine it.
 * I imagine that when done, you can then transfer the site to a web hoster who 
   from then on can host your website for everyone.
 * You can try this yourself here, you “just” need an OpenAI API key that will be
   stored in your local storage: [https://akirk.github.io/website-liberator/](https://akirk.github.io/website-liberator/)
 * Source (very unpolished) at [https://github.com/akirk/website-liberator/](https://github.com/akirk/website-liberator/)
 * Some notes on this first implementation:
    - Every message is a new conversation. Modifying a website can be token intense,
      so for now it cannot refer to previous messages.
    - It’s using [function call](https://platform.openai.com/docs/guides/gpt/function-calling)
      [i](https://platform.openai.com/docs/guides/function-calling)[ng](https://platform.openai.com/docs/guides/gpt/function-calling)
      to allow OpenAI to gather more information to fulfil the request.
    - Chosing the right functions to provide can be tricky.
       * I’ve even gone so far to [adapt the list of available functions depending on how deep you are in the function calling stack](https://github.com/akirk/website-liberator/blob/5e3acc3d2aaa0c652289da78edae43cf46b34d7b/index.html#L677):
       * If it has a function available to navigate the user to a screen, it would
         prefer to do that vs just creating a page itself. By removing that function
         early on, it needs to do the latter.
    - It uses different models depending on the task. gpt4-vision-preview for the
      screenshot, gpt-3.5-turbo for the rest. I need to experiment more with gpt-
      4 for the latter tasks.
 * Finally, a screen recording of an early iteration, I have since moved the chat
   to the right side.
 * As I’ve been working on the prototype, it has shown to be interesting to have
   the bot be there just for customizing sites, it can create and modify pages, 
   update settings of the website. Maybe install plugins.
 * So starting with a basis from screenshots and imported data, it might just be
   able to assist you to arrive at a comparable WordPress website, and all with 
   the ease and effortless setup of WordPress Playground. I wonder where we can 
   take this!
 * 
   #### Bonus
   
 * Some screenshots from a [recent version](https://akirk.github.io/website-liberator/?):
 * ![](https://alex.kirk.at/wp-content/uploads/sites/2/2023/12/create-page-cars-
   1024x595.png)
 * ![](https://alex.kirk.at/wp-content/uploads/sites/2/2023/12/cars-essay-1024x594.
   png)
 * [AI](https://alex.kirk.at/category/ai/), [Code](https://alex.kirk.at/category/code/),
   [Explorations](https://alex.kirk.at/category/explorations/), [WordPress](https://alex.kirk.at/category/wordpress/)
 * [openai](https://alex.kirk.at/tag/openai/), [playground](https://alex.kirk.at/tag/playground/),
   [vision](https://alex.kirk.at/tag/vision/), [WordPress](https://alex.kirk.at/tag/wordpress/)

 [Previous Page](https://alex.kirk.at/page/18/?output_format=md&term_id=44048) [Next Page](https://alex.kirk.at/page/20/?output_format=md&term_id=44048)