Utility CLI tool for Akkoma admins
Find a file
2025-11-30 00:00:00 +00:00
.gitignore Initial commit 2025-08-04 00:00:00 +00:00
Makefile make: move tests to external script 2025-10-13 00:00:00 +00:00
README.rst readme: add example SQL query 2025-11-30 00:00:00 +00:00
shinyr.c Fix base62 decoder bug 2025-10-13 00:00:00 +00:00
test.sh test: exhaustively test single-digit base62 de- and encoding 2025-10-25 00:00:00 +00:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Shiny Rod
=========

Utility tool for Akkoma admins.

Can e.g. convert between API IDs (e.g.: ``AwnW35HP3S0ADNCM76``)
and Flake database IDs usable in SQL queries (e.g.: ``00000198-70ad-868e-8d3a-6d2726850000``)
and extract timestamps from non-legacy IDs.

Note the database ID of posts points at ``Create`` entries in the ``activities`` table,
**not** directly the (usually) ``Note`` entries in ``objects``!

Run ``shinyr -h`` to get a list of all modes and options.

Building
--------

It needs a C compiler supporting ``unsigned __int_128`` (e.g. non-ancient ``gcc``  or ``clang``),
in the future this may be switched out for requiring C23s ``_BitInt(128)`` but at the moment
support for the former is more widely available than the latter.  
*(Though, if it ever gains more features theres a high chance it will be rewritten to gain more ergonomic interactions with REST APIs)*

Example
-------
```sh
# modern IDs
./shinyr api2db AwnW35HP3S0ADNCM76
## 00000198-70ad-868e-8d3a-6d2726850000
./shinyr db2api 00000198-70ad-868e-8d3a-6d2726850000
##    AwnW35HP3S0ADNCM76

# legacy IDs
./shinyr api2db 123
## 00000000-0000-0000-0000-00000000007b
./shinyr db2api 00000000-0000-0000-0000-00000000007b
## 123
```

Using a database ID to query both the activity and object of a post:
```sql
SELECT a.*, o.*
FROM objects AS o JOIN activities AS a
     ON COALESCE(a.data->'object'->>'id', a.data->>'object') = o.data->>'id'
WHERE a.id = '00000198-70ad-868e-8d3a-6d2726850000';
```