API: follower lists, blocking, reports, admin; drop Spotify sign-in
- Followers/following lists (paginated), 'follows you', remove a follower - Blocking severs follows both ways and hides each user from the other (profile 404s, search, follows); the blocker sees activity hidden - Reports for moderation (App Store guideline 1.2) - First account on a server becomes admin; admins see the report queue, resolve reports, and suspend accounts (signs out, blocks login, hides the profile, stops sharing). set-role script to promote/demote - users.onboardedAt drives first-run onboarding; existing accounts are backfilled as already onboarded. Empty PATCH /me no longer 500s - Remove Spotify account sign-in and polling: Spotify caps new apps at 5 accounts, so Spotify arrives via its Last.fm/ListenBrainz link or the Android reader. App-level catalog search stays for exact links - Shared: QR code generation and profile-link parsing (verified with jsQR) - Integration test timeout raised; password hashing is slow by design Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzFywujuH9TiuXbr9vjoX8
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import qrcode from 'qrcode-generator';
|
||||
|
||||
export interface QrShape {
|
||||
/** Width/height in modules (no quiet zone; renderers add margin). */
|
||||
size: number;
|
||||
/** SVG path in module units: draw it in a `0 0 size size` viewBox. */
|
||||
path: string;
|
||||
}
|
||||
|
||||
/** Dark/light grid for `text`. Medium error correction survives a scratched or dim screen. */
|
||||
export function qrMatrix(text: string): boolean[][] {
|
||||
const qr = qrcode(0, 'M'); // 0 = smallest version that fits
|
||||
qr.addData(text);
|
||||
qr.make();
|
||||
const n = qr.getModuleCount();
|
||||
return Array.from({ length: n }, (_, row) => Array.from({ length: n }, (_, col) => qr.isDark(row, col)));
|
||||
}
|
||||
|
||||
/** One SVG path for the whole code, merging horizontal runs so it stays small to render. */
|
||||
export function qrShape(text: string): QrShape {
|
||||
const matrix = qrMatrix(text);
|
||||
let path = '';
|
||||
matrix.forEach((cells, y) => {
|
||||
let x = 0;
|
||||
while (x < cells.length) {
|
||||
if (!cells[x]) {
|
||||
x++;
|
||||
continue;
|
||||
}
|
||||
const start = x;
|
||||
while (x < cells.length && cells[x]) x++;
|
||||
path += `M${start} ${y}h${x - start}v1h${start - x}z`;
|
||||
}
|
||||
});
|
||||
return { size: matrix.length, path };
|
||||
}
|
||||
Reference in New Issue
Block a user