summaryrefslogtreecommitdiff
path: root/lib/Multi/API.pm
AgeCommit message (Collapse)AuthorFilesLines
2024-03-28!BREAKING! Restructure directory layout for generated & runtime filesYorhel1-1/+1
My testing, deployment and backup scripts were getting more complicated with files from various stages being lumped into a single directory structure, so all generated files (= anything touched by 'make') and runtime files (= anything touched by the web backend or multi) have now been moved into separate directories. These directories are also configurable with $VNDB_GEN and $VNDB_VAR, making it possible to manage multiple instances from a single source checkout. I also got rid of *data/* and *dl/* while I was at it, and moved *static/st/* (that is, the screenshot thumbnails) to */sf.t/*, to be consistent with the newer and more flexible image directory naming scheme. This commit breaks all existing installations and upgrading requires manual action. General upgrade instructions: # BEFORE doing a checkout of this commit make clean # AFTER make mkdir -p var/static var/log mv static/st var/static/sf.t mv static/{sf,ch,cv}{,.orig} var/static/ mv data/conf.pl var/ mv data/log var/ mv data/hibp var/ mv dl var/ util/setup-var.sh Use `git status` find leftover files to clean up or move. Don't forget to update conf.pl and web server configuration to make sure they access the new paths.
2024-03-23API fixes: reject delete_at logins/tokens + fix "get quote" commandYorhel1-3/+7
2023-09-17Producer::Edit: Convert form to JSYorhel1-1/+1
This one got priority because many people appear to be stumbling on the URL validation bug in this form. Staff edit form is still affected by it, but that's less commonly a problem. New form also doesn't pre-fill a language anymore and instead requires the user to input one manually. Fixes a problem with non-JP producer entries having JP selected by default.
2023-08-06Save original image uploadsYorhel1-1/+1
So that they can be recompressed or resized to new formats, in case we ever add support for alternative sizes or formats.
2023-07-11Remove popularity rating + adjust bayesian averageYorhel1-3/+3
As discussed in https://vndb.org/t20453
2023-05-03SQL: Rename columns that are SQL keywordsYorhel1-4/+4
So that there aren't any columns in need of quoting anymore.
2023-03-24Search backend changes: faster results with trigram index + rankingYorhel1-4/+4
With this ranking system, searching for titles like 'L' and 'ONE.' is now at least possible, and YU-NO at least shows up on the first page when searching for "yu no". The actual normalization and matching algorithm hasn't really changed, except that all search terms must now match a single title, but there's still a whole bunch of false positives. Ranking is not available through the API yet. The trigram index should make it possible to do site-wide searching at a more reasonable speed, I'll experiment with that later.
2023-03-20Also swap staff name/originalYorhel1-9/+8
That should be the last one.
2023-03-20Swap chars name/original as wellYorhel1-11/+11
2023-03-20Swap producer name/original to be consistent with VN/release titlesYorhel1-14/+14
This goes a bit further than just swapping them in the edit form (which is the only visible change, hopefully), since I also wanted some consistency in the DB & backend code. TODO: Staff & chars.
2023-02-19Rework passing around entry titles + add proper HTML5 'lang' attrsYorhel1-18/+18
This is a huge back-end change for a small benefit, but it also improves consistency a bit in the way that titles are handled and passed around. The Elm code still uses separate title/alttitle fields at various places, not sure if I want to bother converting that, too. I'm sure there's bugs, given how many files this touches.
2022-12-03Switch to the HIBP password databaseYorhel1-3/+2
Currently has 851 million password hashes, taking about 8G of space with the current approach. It's simple and fast, so should be worth it. inb4 complains about "why can't I use my password anymore!?"
2022-11-29API2: Implement token-based authentication + GET /authinfoYorhel1-1/+1
+ update filters and APIs to respect the 'listread' permission.
2022-10-31Multi::API: Fix "original" filter for get releaseYorhel1-3/+3
2022-10-31SQL: Merge ulist_vns_labels into ulist_vns as array + cache private flagYorhel1-72/+47
This reduces the database size a bit and slightly simplifies and significantly speeds up certain queries. Touches a fair amount of tricky code, so I'm sure there's bugs. The only visible change I'm aware of is that the deprecated 'get/set wishlist' API command now doesn't handle priorities anymore.
2022-10-08SQL: Reduce size of images table + set a max of 15 votesYorhel1-4/+4
Reduction is by 12 bytes per row, by simply encoding the same data as smallints. We never needed the full range of the real/integer types. (Could go even further, but postgres doesn't have a uint8 type and encoding avg + stddev in the same column feels a bit too hacky) Having more than 15 votes on an image is pretty useless, so by removing images with sufficient votes from the image voting selection we can avoid further bloating the table. (c_weight is still >0 even for images that shouldn't be selected anymore, because this field is also abused to check if an image is referenced somewhere in the DB. Instead, images with c_weight=1 are now excluded from selection. This has the side effect of also excluding images with 14 votes and stddev=0, but that seems okay)
2022-10-04API: Add release.official + more image dimensionsYorhel1-4/+12
2022-10-02API: Use deterministic ORDER BY to fix paginationYorhel1-9/+9
Fixes https://vndb.org/t19163.7
2022-10-02API: Add VN length vote statsYorhel1-1/+4
2022-10-02API: Add release linksYorhel1-2/+20
2022-10-02API: Add VN + release titlesYorhel1-0/+26
2022-09-28Multi::API: Update for new schemaYorhel1-6/+6
2022-02-11Update Multi::(IRC|API) to work with the new vn_titles schemaYorhel1-11/+11
The API only exposes the legacy "title"/"original" fields for compatibility, exposing the full title list requires an API change and should be done eventually.
2021-12-15API: Add support for session tokensYorhel1-13/+48
2021-11-19Use new search for VNs; remove search cache updating from MultiYorhel1-3/+2
2021-11-19Search adjustments + use new search for producers,staff,characters tooYorhel1-3/+3
2021-11-15Make release type a property of the release<->vn relationYorhel1-3/+8
That is, allow a release to have different types per VN, such as a complete release for one VN that includes a trial for another.
2021-10-28Allow uppercase characters in usernamesYorhel1-6/+6
Usernames are now case-insensitive and name changes and new registrations are now checked for homograph attacks.
2021-06-04Fix use of c_(rating|popularity) in API and AdvSearch filtersYorhel1-2/+2
2021-03-23Traits: Convert to vndbids + add edit historyYorhel1-3/+3
Much the same as the previous conversion of tags.
2021-03-11Tags: Convert to vndbids + add edit historiesYorhel1-3/+3
Another commit with changes all across the tree. But at least we have a tangible improvement now: edit histories for tags.
2021-03-05API: *Actually* fix staff (id=[array]) filterYorhel1-1/+1
2021-03-04Releases: Store unknown minage as NULL + fix default for new entriesYorhel1-1/+1
Fixes https://vndb.org/t950.905, which also reminded me that I can now finally store unknown as NULL rather than -1. The v2rw rewrite was preventing me from changing that earlier, handling NULLs was more annoying in the old v2 code.
2021-03-04API: Fix staff (id=[array]) filterYorhel1-1/+1
https://vndb.org/t12641.19
2021-03-01API: Fix bug with VN filter in list commandsYorhel1-2/+2
https://vndb.org/t12641.14
2021-03-01SQL: vndbid data type conversion for most DB entriesYorhel1-100/+105
I had wanted to split this up into multiple commits and roll out in stages, but couldn't really find a natural way to do so. There are several places that take a generic identifier and expect it to work the same for all entries they support, so changing one entry at a time wasn't going to be any easier. Only the tags & traits haven't been updated yet, I'll convert those later. While this is a major change and affects a lot of code, the individual changes are all pretty simple. I'm surprised how much code did not have to be updated at all. No doubt I've missed a few places, though, so this commit will almost certainly break something.
2021-02-20cleanup: Merge VNDBUtil into VNDB::FuncYorhel1-7/+7
Something I was planning to do in the v2rw rewrite. VNDB::Func used to be a module intended for use inside TUWF (i.e. the web backend) while VNDBUtil was for utility functions that could also be used outside of that. Now that the web backend has moved to the VNWeb::* namespace, the VNDB::Func module has taken over the role of VNDBUtil. Also updated the API code to make use of the 'imgurl' function, which is a nice additional cleanup.
2021-01-30Add "original language" field to VN entriesYorhel1-4/+4
As a more explicit replacement to the automatically inferred (and sometimes wrong) c_olang. Also to be used for title display customization later on: https://vndb.org/t12465
2021-01-08Multi::API: Fix harmless perl warning on "get quote" order by randomYorhel1-1/+1
2020-12-29API: Add "get quote" commandYorhel1-0/+19
2020-11-13API: Add spoiler_gender, age, & cup_size fields to get characterYorhel1-3/+5
2020-07-13Multi::API: Fix harmless Perl warning for entries without imageYorhel1-1/+2
2020-07-12API: Fix JSON type of image_flagging.votecountYorhel1-1/+1
Should be output as an integer rather than a string. Fixes #28.
2020-07-09Multi::API: Fix confusion between vn.c_votecount and images.c_votecountYorhel1-2/+2
2020-07-09API: Deprecate NSFW flags and add image_flagging summaryYorhel1-8/+27
2020-06-15Releases: Allow custom resolutions to be enteredYorhel1-3/+5
The resolution field now works much like the engine field.
2020-04-16API: get ulist: Always return and allow filtering on label 7 (Voted)Yorhel1-2/+2
This allows filtering on (label=7) even when the user has set that label to private and that label will now also be returned with the 'labels' flag. The $ULIST_PUBLIC check in the main query will ensure that only public VNs are included in the results.
2020-04-09Stop keeping track of users/threads/posts count cacheYorhel1-2/+1
Those stats havent been displayed on the site for ages, anyway. The API will now report '0' for these stats.
2020-04-05SQL: Add C-based "vndbid" type and use it for image IDsYorhel1-3/+3
I had already rambled on the current composite type solution in 583ae868dfd3c882a8d2dd40b5d5ed099170c1c2 and I had already explored a few alternatives. This was the one alternative I hadn't yet explored because I wasn't sure the operational complexity was going to be worth it, but after seeing how bad PostgreSQL was at optimizing queries with composite types, I figured I might as well just go with this approach. It improves performance of some queries by a *lot* (especially the image selection query) and it's pretty elegant and convenient to work with. Only downside is the complexity of compiling, installing and maintaining a vndbid.so library for PostgreSQL.
2020-03-12SQL: Use global "images" table for metadata of all images in the DBYorhel1-4/+4
In preparation for an image flagging feature. This replaces the 'screenshots' table. I played around with various implementations of a primary key for the images table; A single integer encoding both the type and id is most efficient, but kind of ugly to work with. Two separate columns are also ugly and force the creation of a separate 'image_type' column on all referencing tables. The current composite type isn't all that much better, but at least it makes it easy to keep treating the image id as a single entity. Old VNDB::* code still treats it as an integer with different namespaces, new VNWeb::* code treats it as a proper composite type.