Ahwxorg / Binternet

A custom Pinterest frontend, made in PHP.
GNU General Public License v3.0
116 stars 12 forks source link

Add next page button #23

Closed qminlh closed 10 months ago

qminlh commented 11 months ago

Added a "Next page" button.

Technical details

First of all, in the description below I'm mentioning "search data" - it's a JSON object that can be defined as follows (TypeScript-style definition):

{
    options: {
        query: string,  // search query
        bookmarks?: string[],  // undefined for first page; if defined, it's an array containing a single string that is a reference to current position
        // irrelevant stuff
    },
    // irrelevant stuff
}

Requests for new images are made to the URL "https://www.pinterest.com/resource/BaseSearchResource/get/". First request is done as a GET method and contains URL-encoded search data as a query parameter with key data (that part is already implemented), while further requests are done with POST method and the query parameter is moved to request body together with the key, with encoding unchanged.

In POST requests, search data also needs to contain bookmarks - an array containing a single string, which serves as a reference to user's current position/page. The string is located in previous response, in .resource_response.bookmark. These requests also need a csrftoken cookie, which is received on a first request.

Implementation notes

Additional notes

Fixes #2

Ahwxorg commented 11 months ago

Is the XSS vuln patched in the latest commit? @qminlh

qminlh commented 11 months ago

Is the XSS vuln patched in the latest commit? @qminlh

Yes

Ahwxorg commented 10 months ago

Alright, merging it :)