okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

dawnimages: refuse a PNG or JPEG cut short where it is attached, so it never reaches history79b55b3

main
669 B14 linesraw
1-module(albedo_image_store_test_support).
2-export([legacy_payload/2, exists/1, legacy_fingerprint/3]).
3
4%% A transcript row as written before images were stored: the payload inline.
5legacy_payload(Text, Data) ->
6    term_to_binary({1, {user_image, Text, {image, <<"image/png">>, Data, 2, 3, 45}}}).
7
8exists(Path) -> filelib:is_regular(Path).
9
10%% What rolling's fingerprint returned for #(Source, [UserImage(Text, _)])
11%% before images were stored.
12legacy_fingerprint(Source, Text, Data) ->
13    Term = {Source, [{user_image, Text, {image, <<"image/png">>, Data, 2, 3, 45}}]},
14    binary:encode_hex(crypto:hash(sha256, term_to_binary(Term, [deterministic])), lowercase).