aboutsummaryrefslogtreecommitdiff
path: root/util.go
Commit message (Collapse)AuthorAgeFilesLines
* docs: document the exported API, and fix five bugs found writing it (#2)v0.3.2Christian Cleberg2026-07-151-8/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * docs: translate Russian comments and document exported API The package carried 35 Russian comments and no doc comments on its exported identifiers, so pkg.go.dev rendered a bare list of signatures. Translate the Russian to English and give every exported identifier a doc comment in godoc form. Add doc.go with a package overview covering the guest-session requirement, the Error-as-struct convention, and CloudFront blocking. The comments record what the signatures cannot: that UpdateCSRF must run first and that its token expires, that Error is a struct and so is never nil, that Thread is one comment rather than a thread, and that GetComments' page parameter costs one request per page. Comments only; the struct field realignment is gofmt's, from doc comments splitting alignment groups. Refs #1 * add CODEOWNERS * fix: stop the library killing its caller, and flatten text correctly Writing doc comments for the exported API surfaced behavior too alarming to document and leave alone. A library should never terminate the process that imports it. Crashes: - GetComments panicked on a comment with an empty body: the shape check read m[0] and m[len(m)-1] with no length check. - Group.Favourites and Group.Gallery indexed their variadic folderid without checking len, so omitting it — which the signature invites — panicked. Omitting it now means 0. - AEmedia and PerformSearch called log.Fatalln on a bad argument rune, terminating the caller. Both now return an error, which their signatures already allowed for. Draft.js flattening, in the same code both callers share: - The block loop assigned rather than accumulated, so every block but the last was dropped and a multi-paragraph body came back as its closing line alone. Blocks are block-level elements, so join them with newlines. - GetDeviation guarded on txt[1] == '{', the second character of a body that opens with {"blocks". It never fired, so descriptions were handed back as raw Draft.js JSON. It now shares flattenComment with GetComments rather than keeping its own copy. Both flattening fixes change output for existing callers. Refs #1
* fix: restore optional username in PerformSearch, apply gofmtv0.3.1Christian Cleberg2026-07-141-7/+8
| | | | | | | | | | | | The golangci-lint cleanup added a top-level `user == nil` guard to PerformSearch, but `user` is variadic and only required for the 'g' and 'f' scopes. The guard made every 'a'/'t' search fail with "missing username" before issuing a request, breaking general search for all callers. The correctly scoped check inside the 'g','f' case already covers the case that needs it. Also run gofmt: the same cleanup introduced space indentation in deviantion.go, user-group.go, and util.go, which fails the gofmt CI step.
* fix: resolve golandci-lint errorsChristian Cleberg2026-07-141-1/+5
|
* fix: resolve nil-deref crash, CSRF panic, add timeouts + clear CDN-block ↵Christian Cleberg2026-07-141-8/+93
| | | | | | errors; repoint module to zerolabsco References: https://github.com/zerolabsco/skunky-art/issues/2
* ошибкиlost+skunk2024-09-041-4/+18
|
* Парсер медии с кастомным разрешениемv0.2.5lost+skunk2024-07-301-16/+14
|
* Небольшие улучшения в группахlost+skunk2024-07-041-0/+112