45 lines
1.4 KiB
ReStructuredText
45 lines
1.4 KiB
ReStructuredText
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 C23’s ``_BitInt(128)`` but at the moment
|
||
support for the former is more widely available than the latter.
|
||
*(Though, if it ever gains more features there’s 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';
|
||
```
|