diff --git a/src/lib/collectors.js b/src/lib/collectors.js index f2f3f48..e5245a2 100644 --- a/src/lib/collectors.js +++ b/src/lib/collectors.js @@ -96,9 +96,7 @@ function fetchUserFromHTML(username) { } } } - let quotaUsed = 0 return userRequestCache.getOrFetch("user/"+username, false, true, () => { - quotaUsed++ return switcher.request("user_html", `https://www.instagram.com/${username}/feed/`, async res => { if (res.status === 301) throw constants.symbols.ENDPOINT_OVERRIDDEN if (res.status === 302) throw constants.symbols.INSTAGRAM_DEMANDS_LOGIN @@ -155,7 +153,7 @@ function fetchUserFromHTML(username) { } throw error }) - }).then(user => ({user, quotaUsed})) + }).then(user => ({user, quotaUsed: 0})) } /** diff --git a/src/site/api/routes.js b/src/site/api/routes.js index c1d3f9e..b7fdda4 100644 --- a/src/site/api/routes.js +++ b/src/site/api/routes.js @@ -13,16 +13,6 @@ function getPageTitle(post) { return (post.getCaptionIntroduction() || `Post from @${post.getBasicOwner().username}`) + " | Bibliogram" } -async function getUserAndQuota(req, username) { - if (quota.remaining(req) === 0) { - throw constants.symbols.QUOTA_REACHED - } - - const {user, quotaUsed} = await fetchUser(username) - const remaining = quota.add(req, quotaUsed) - return {user, remaining} -} - function getPostAndQuota(req, shortcode) { if (quota.remaining(req) === 0) { throw constants.symbols.QUOTA_REACHED @@ -111,7 +101,8 @@ module.exports = [ throw constants.symbols.QUOTA_REACHED } - let {user, remaining} = await getUserAndQuota(req, username) + const {user, quotaUsed} = await fetchUser(username) + let remaining = quota.add(req, quotaUsed) const selectedTimeline = user[type] let pageNumber = +params.get("page") diff --git a/src/site/html/static/fonts/cantarell-bold.ttf b/src/site/html/static/fonts/cantarell-bold.ttf deleted file mode 100644 index af5f05a..0000000 Binary files a/src/site/html/static/fonts/cantarell-bold.ttf and /dev/null differ diff --git a/src/site/html/static/fonts/cantarell-bold.woff2 b/src/site/html/static/fonts/cantarell-bold.woff2 deleted file mode 100644 index cfee192..0000000 Binary files a/src/site/html/static/fonts/cantarell-bold.woff2 and /dev/null differ diff --git a/src/site/html/static/fonts/cantarell-normal.ttf b/src/site/html/static/fonts/cantarell-normal.ttf deleted file mode 100644 index f5d16d7..0000000 Binary files a/src/site/html/static/fonts/cantarell-normal.ttf and /dev/null differ diff --git a/src/site/html/static/fonts/cantarell-normal.woff2 b/src/site/html/static/fonts/cantarell-normal.woff2 deleted file mode 100644 index b9865d0..0000000 Binary files a/src/site/html/static/fonts/cantarell-normal.woff2 and /dev/null differ diff --git a/src/site/html/static/js/pagination.js b/src/site/html/static/js/pagination.js index 12302ed..dc76b48 100644 --- a/src/site/html/static/js/pagination.js +++ b/src/site/html/static/js/pagination.js @@ -79,12 +79,8 @@ class NextPage extends FreezeWidth { this.freeze(this.element.getAttribute("data-loading-text")) const type = this.element.getAttribute("data-type") - return fetch(`/fragment/user/${this.element.getAttribute("data-username")}/${this.nextPageNumber}?type=${type}`).then(res => { - if (res.status === 200) { - quota.change(-1) - } - return res.text() - }).then(text => { + return fetch(`/fragment/user/${this.element.getAttribute("data-username")}/${this.nextPageNumber}?type=${type}`).then(res => res.text()).then(text => { + quota.change(-1) q("#next-page-container").remove() this.observer.disconnect() q("#timeline").insertAdjacentHTML("beforeend", text) diff --git a/src/site/pug/quota_reached.pug b/src/site/pug/quota_reached.pug index 95a84b5..85b1e49 100644 --- a/src/site/pug/quota_reached.pug +++ b/src/site/pug/quota_reached.pug @@ -19,7 +19,4 @@ html | To prevent bot abuse, all users on proxy networks share the same request quota. | | - | If you are automatically collecting data from Bibliogram, please do not! - | #[a(href="https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Installing%20%28basic%29.md") You can easily run your own copy with no quota.] / #[a(href="https://cadence.moe/contact") Get in touch if you want help? <3] - | | diff --git a/src/site/sass/includes/_main.sass b/src/site/sass/includes/_main.sass index f4d115a..fe496ee 100644 --- a/src/site/sass/includes/_main.sass +++ b/src/site/sass/includes/_main.sass @@ -5,24 +5,16 @@ $theme: () !default @font-face font-family: "Bariol" - font-display: swap // prefer a fallback font until the font file is loaded + font-display: swap src: url(/static/fonts/bariol.woff2) format("woff2"), url(/static/fonts/bariol.ttf) format("truetype") -@each $weight in normal, bold - @font-face - font-family: "Cantarell" - font-weight: $weight - src: url(/static/fonts/cantarell-#{$weight}.woff2) format("woff2"), url(/static/fonts/cantarell-#{$weight}.ttf) format("truetype") - font-display: swap // prefer a fallback font until the font file is loaded - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD // from google fonts definition, https://fonts.googleapis.com/css2?family=Cantarell - body font-family: "Bariol", sans-serif body.use-boring-font // this is useful so that cyrillic and other scripts don't look conspicuous compared to nearby latin letters. // the use-boring-font class is activated based on the page and heuristics of its contents - font-family: "Cantarell", sans-serif + font-family: sans-serif input, button, textarea font-family: inherit @@ -42,7 +34,7 @@ body @media screen and (min-width: $layout-b-min) display: grid - grid-template-columns: 250px 1fr + grid-template-columns: 235px 1fr .pfp border-radius: 50%