postimg.cc is currently the only image host moho can put a picture on
(nobilis/src/backend/sneedchat/postimg.rs), and Host in nobilis/src/upload.rs
offers catbox and litterbox beside it for anything that is not an image. That is thin
in two ways that matter:
It is a single point of failure. When postimg is down or refuses an upload, the
only fallback is a general file host, and a link to catbox is not the same thing as
an embedded picture on a forum or in a channel.
It refuses formats that are ordinary images. avif is the standing example - it is
routed to catbox instead, deliberately, because postimg will not take it.
ibb.co (imgbb) would be the second, and is the obvious candidate: anonymous upload, no
account, direct links, and a wider accepted-format list than postimg's.
The work
Most of this is discovery, the same shape the postimg host needed. postimg.rs's own
doc comments are the worked example and should be read first - the advertised "official
API" there required registration and returned an empty body anonymously, and what
actually worked was the plain form POST a browser makes, reverse-engineered from a HAR
capture, with Origin and Referer set so it did not 403.
Expect the same here:
Capture a real anonymous upload to ibb.co in a browser and read the HAR.
Work out the endpoint, the form fields, and which headers are load-bearing. ibb.co
is known to want a per-session auth_token lifted from the upload page, so there is
probably a fetch-the-page-first step that postimg did not need.
Find the real accepted-format list and the size cap, from the page's own JS if it
declares them the way postimg's maxFilesize:33554432 did.
Find which of the response's several links is the stable direct one.
Fitting it in
The plumbing is already in the right shape and should not need rearranging:
Add an Ibb variant to Host in nobilis/src/upload.rs, with label, max_bytes
and an accepted_extensions table of its own.
That table is the single source for both the multipart content type and what hosts() publishes over listUploadHosts, which is what stops the client's idea of
what a host takes from drifting from the daemon's. Do not spell the list twice - see
the comment above POSTIMG_TYPES for what happened the time it was.
The client needs nothing new: uploadHost() in src/renderer/src/state/store.ts
already picks a host from preferences and reroutes when the chosen one will not take
the file, and the settings panel draws its menu from listUploadHosts.
Why it helps IRC and Sneedchat in particular
Both are protocols with no upload of their own - a picture is shared by posting a link
to it, so the host is the feature, and having exactly one of them is the whole
exposure. Discord and Matrix upload to their own servers and are unaffected either way.
Worth checking while doing this whether ibb.co takes avif; if it does, it becomes the
sensible default image host for the formats postimg refuses, instead of those falling
back to a general file host.
postimg.cc is currently the only image host moho can put a picture on
(`nobilis/src/backend/sneedchat/postimg.rs`), and `Host` in `nobilis/src/upload.rs`
offers catbox and litterbox beside it for anything that is not an image. That is thin
in two ways that matter:
- **It is a single point of failure.** When postimg is down or refuses an upload, the
only fallback is a general file host, and a link to catbox is not the same thing as
an embedded picture on a forum or in a channel.
- **It refuses formats that are ordinary images.** avif is the standing example - it is
routed to catbox instead, deliberately, because postimg will not take it.
ibb.co (imgbb) would be the second, and is the obvious candidate: anonymous upload, no
account, direct links, and a wider accepted-format list than postimg's.
### The work
Most of this is discovery, the same shape the postimg host needed. `postimg.rs`'s own
doc comments are the worked example and should be read first - the advertised "official
API" there required registration and returned an empty body anonymously, and what
actually worked was the plain form POST a browser makes, reverse-engineered from a HAR
capture, with `Origin` and `Referer` set so it did not 403.
Expect the same here:
1. Capture a real anonymous upload to ibb.co in a browser and read the HAR.
2. Work out the endpoint, the form fields, and which headers are load-bearing. ibb.co
is known to want a per-session `auth_token` lifted from the upload page, so there is
probably a fetch-the-page-first step that postimg did not need.
3. Find the real accepted-format list and the size cap, from the page's own JS if it
declares them the way postimg's `maxFilesize:33554432` did.
4. Find which of the response's several links is the stable direct one.
### Fitting it in
The plumbing is already in the right shape and should not need rearranging:
- Add an `Ibb` variant to `Host` in `nobilis/src/upload.rs`, with `label`, `max_bytes`
and an `accepted_extensions` table of its own.
- That table is the single source for both the multipart content type and what
`hosts()` publishes over `listUploadHosts`, which is what stops the client's idea of
what a host takes from drifting from the daemon's. Do not spell the list twice - see
the comment above `POSTIMG_TYPES` for what happened the time it was.
- The client needs nothing new: `uploadHost()` in `src/renderer/src/state/store.ts`
already picks a host from preferences and reroutes when the chosen one will not take
the file, and the settings panel draws its menu from `listUploadHosts`.
### Why it helps IRC and Sneedchat in particular
Both are protocols with no upload of their own - a picture is shared by posting a link
to it, so the host *is* the feature, and having exactly one of them is the whole
exposure. Discord and Matrix upload to their own servers and are unaffected either way.
Worth checking while doing this whether ibb.co takes avif; if it does, it becomes the
sensible default image host for the formats postimg refuses, instead of those falling
back to a general file host.
ibb.co is a second image host: anonymous, permanent, 32 MB, and it takes avif, heic and jxl. It works like the site's own uploader: the page's per-session auth_token is posted back with its session cookie to /json. The reply's image.url is the direct link.
imgur is also offered: images up to 20 MB (no avif), through its public upload API using the client id of imgur's own web app. It is not offered to Sneedchat, whose forum does not embed imgur links. The host listing marks it notFor: ["sneedchat"], the settings menu leaves it out, and the daemon refuses it on a Sneedchat send.
Sneedchat now wraps any picture a browser draws in [img], so an avif on ibb arrives as a picture.
Verified with live uploads: png and avif to ibb, png to imgur. All served back as image/png / image/avif.
avif is not routed to ibb automatically: the client's rule that a file never goes to a host nobody chose still holds. Pick ibb.co under a service's image host setting.
Finished in https://git.salastil.com/Salastil/nobilis/commit/f6c39c2 and https://git.salastil.com/Salastil/moho/commit/54df70a
- **ibb.co** is a second image host: anonymous, permanent, 32 MB, and it takes **avif**, heic and jxl. It works like the site's own uploader: the page's per-session `auth_token` is posted back with its session cookie to `/json`. The reply's `image.url` is the direct link.
- **imgur** is also offered: images up to 20 MB (no avif), through its public upload API using the client id of imgur's own web app. It is **not offered to Sneedchat**, whose forum does not embed imgur links. The host listing marks it `notFor: ["sneedchat"]`, the settings menu leaves it out, and the daemon refuses it on a Sneedchat send.
- Sneedchat now wraps any picture a browser draws in `[img]`, so an avif on ibb arrives as a picture.
Verified with live uploads: png and avif to ibb, png to imgur. All served back as `image/png` / `image/avif`.
avif is not routed to ibb automatically: the client's rule that a file never goes to a host nobody chose still holds. Pick ibb.co under a service's image host setting.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
postimg.cc is currently the only image host moho can put a picture on
(
nobilis/src/backend/sneedchat/postimg.rs), andHostinnobilis/src/upload.rsoffers catbox and litterbox beside it for anything that is not an image. That is thin
in two ways that matter:
only fallback is a general file host, and a link to catbox is not the same thing as
an embedded picture on a forum or in a channel.
routed to catbox instead, deliberately, because postimg will not take it.
ibb.co (imgbb) would be the second, and is the obvious candidate: anonymous upload, no
account, direct links, and a wider accepted-format list than postimg's.
The work
Most of this is discovery, the same shape the postimg host needed.
postimg.rs's owndoc comments are the worked example and should be read first - the advertised "official
API" there required registration and returned an empty body anonymously, and what
actually worked was the plain form POST a browser makes, reverse-engineered from a HAR
capture, with
OriginandRefererset so it did not 403.Expect the same here:
is known to want a per-session
auth_tokenlifted from the upload page, so there isprobably a fetch-the-page-first step that postimg did not need.
declares them the way postimg's
maxFilesize:33554432did.Fitting it in
The plumbing is already in the right shape and should not need rearranging:
Ibbvariant toHostinnobilis/src/upload.rs, withlabel,max_bytesand an
accepted_extensionstable of its own.hosts()publishes overlistUploadHosts, which is what stops the client's idea ofwhat a host takes from drifting from the daemon's. Do not spell the list twice - see
the comment above
POSTIMG_TYPESfor what happened the time it was.uploadHost()insrc/renderer/src/state/store.tsalready picks a host from preferences and reroutes when the chosen one will not take
the file, and the settings panel draws its menu from
listUploadHosts.Why it helps IRC and Sneedchat in particular
Both are protocols with no upload of their own - a picture is shared by posting a link
to it, so the host is the feature, and having exactly one of them is the whole
exposure. Discord and Matrix upload to their own servers and are unaffected either way.
Worth checking while doing this whether ibb.co takes avif; if it does, it becomes the
sensible default image host for the formats postimg refuses, instead of those falling
back to a general file host.
Finished in https://git.salastil.com/Salastil/nobilis/commit/f6c39c2 and https://git.salastil.com/Salastil/moho/commit/54df70a
auth_tokenis posted back with its session cookie to/json. The reply'simage.urlis the direct link.notFor: ["sneedchat"], the settings menu leaves it out, and the daemon refuses it on a Sneedchat send.[img], so an avif on ibb arrives as a picture.Verified with live uploads: png and avif to ibb, png to imgur. All served back as
image/png/image/avif.avif is not routed to ibb automatically: the client's rule that a file never goes to a host nobody chose still holds. Pick ibb.co under a service's image host setting.