Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

7 changed files with 30 additions and 215 deletions

View file

@ -68,6 +68,9 @@
`(p ,(format "This instance is run by the ~a developer, " (config-get 'application_name)) `(p ,(format "This instance is run by the ~a developer, " (config-get 'application_name))
(a (@ (href "https://cadence.moe/contact")) (a (@ (href "https://cadence.moe/contact"))
"Cadence") "Cadence")
". Proudly hosted by "
(a (@ (href "http://alphamethyl.barr0w.net"))
"Barrow Network Solutions" (sup "XD"))
".") ".")
`(p `(p
,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application_name))))) ,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application_name)))))
@ -85,13 +88,11 @@
;; generate a notice with a link if a fandom wiki has a replacement as part of NIWA or similar ;; generate a notice with a link if a fandom wiki has a replacement as part of NIWA or similar
;; if the wiki has no replacement, display nothing ;; if the wiki has no replacement, display nothing
(define (extwiki-notice wikiname title req user-cookies) (define (extwiki-notice wikiname title)
(define xt (findf (λ (item) (member wikiname (extwiki^-wikinames item))) extwikis)) (define xt (findf (λ (item) (member wikiname (extwiki^-wikinames item))) extwikis))
(cond/var (cond/var
[xt [xt
(let* ([seen? (member wikiname (user-cookies^-notices user-cookies))] (let* ([group (hash-ref extwiki-groups (extwiki^-group xt))]
[aside-class (if seen? "niwa__notice niwa--seen" "niwa__notice")]
[group (hash-ref extwiki-groups (extwiki^-group xt))]
[search-page (format "/Special:Search?~a" [search-page (format "/Special:Search?~a"
(params->query `(("search" . ,title) (params->query `(("search" . ,title)
("go" . "Go"))))] ("go" . "Go"))))]
@ -102,13 +103,13 @@
[props (extwiki-props^ go)]) [props (extwiki-props^ go)])
(cond (cond
[(eq? (extwiki^-banner xt) 'default) [(eq? (extwiki^-banner xt) 'default)
`(aside (@ (class ,aside-class)) `(aside (@ (class "niwa__notice"))
(h1 (@ (class "niwa__header")) ,(extwiki^-name xt) " has its own website separate from Fandom.") (h1 (@ (class "niwa__header")) ,(extwiki^-name xt) " has its own website separate from Fandom.")
(a (@ (class "niwa__go") (href ,go)) "Read " ,title " on " ,(extwiki^-name xt) "") (a (@ (class "niwa__go") (href ,go)) "Read " ,title " on " ,(extwiki^-name xt) "")
(div (@ (class "niwa__cols")) (div (@ (class "niwa__cols"))
(div (@ (class "niwa__left")) (div (@ (class "niwa__left"))
(p ,((extwiki^-description xt) props))
(p ,((extwiki-group^-description group) props)) (p ,((extwiki-group^-description group) props))
(p ,((extwiki^-description xt) props))
(p "This wiki's core community has largely migrated away from Fandom. You should " (p "This wiki's core community has largely migrated away from Fandom. You should "
(a (@ (href ,go)) "go to " ,(extwiki^-name xt) " now!")) (a (@ (href ,go)) "go to " ,(extwiki^-name xt) " now!"))
(p (@ (class "niwa__feedback")) (p (@ (class "niwa__feedback"))
@ -116,10 +117,7 @@
`(,@(for/list ([link (extwiki-group^-links group)]) `(,@(for/list ([link (extwiki-group^-links group)])
`(a (@ (href ,(cdr link))) ,(car link))) `(a (@ (href ,(cdr link))) ,(car link)))
"This notice is from BreezeWiki" "This notice is from BreezeWiki"
(a (@ (rel "nofollow") (a (@ (href "https://docs.breezewiki.com/Reporting_Bugs.html")) "Feedback?"))
(class "niwa__got-it")
(href ,(user-cookies-setter-url/add-notice req user-cookies wikiname)))
"OK, got it"))
" / "))) " / ")))
(div (@ (class "niwa__right")) (div (@ (class "niwa__right"))
(img (@ (class "niwa__logo") (src ,(extwiki^-logo xt)))))))] (img (@ (class "niwa__logo") (src ,(extwiki^-logo xt)))))))]
@ -227,7 +225,7 @@
(div (@ (class "fandom-community-header__background tileHorizontally header"))) (div (@ (class "fandom-community-header__background tileHorizontally header")))
(div (@ (class "page")) (div (@ (class "page"))
(main (@ (class "page__main")) (main (@ (class "page__main"))
,(extwiki-notice wikiname title req user-cookies) ,(extwiki-notice wikiname title)
(div (@ (class "custom-top")) (div (@ (class "custom-top"))
(h1 (@ (class "page-title")) ,title) (h1 (@ (class "page-title")) ,title)
(nav (@ (class "sitesearch")) (nav (@ (class "sitesearch"))

View file

@ -104,7 +104,7 @@
; all values here are optimised for maximum prettiness ; all values here are optimised for maximum prettiness
(parameterize ([pretty-print-columns 80]) (parameterize ([pretty-print-columns 80])
(display "config: ") (display "config: ")
(pretty-write ((inst sort (Pairof Symbol String) Symbol) (pretty-write ((inst sort (Pairof Symbol String))
(hash->list (make-immutable-hasheq combined-alist)) (hash->list (make-immutable-hasheq combined-alist))
symbol<? symbol<?
#:key car)))) #:key car))))

View file

@ -1,7 +1,6 @@
#lang racket/base #lang racket/base
(require racket/list (require racket/list
racket/match racket/match
racket/string
web-server/http/request-structs web-server/http/request-structs
net/url-string net/url-string
(only-in net/cookies/server cookie-header->alist cookie->set-cookie-header make-cookie) (only-in net/cookies/server cookie-header->alist cookie->set-cookie-header make-cookie)
@ -28,8 +27,7 @@
user-cookies-getter user-cookies-getter
user-cookies-default user-cookies-default
user-cookies-setter user-cookies-setter
user-cookies-setter-url user-cookies-setter-url)
user-cookies-setter-url/add-notice)
(struct siteinfo^ (sitename basepage license) #:transparent) (struct siteinfo^ (sitename basepage license) #:transparent)
(struct license^ (text url) #:transparent) (struct license^ (text url) #:transparent)
@ -92,8 +90,8 @@
;; then no matter what, return the best information we have so far ;; then no matter what, return the best information we have so far
this-data)) this-data))
(struct user-cookies^ (theme notices) #:prefab) (struct user-cookies^ (theme) #:prefab)
(define user-cookies-default (user-cookies^ 'default '())) (define user-cookies-default (user-cookies^ 'default))
(define (user-cookies-getter req) (define (user-cookies-getter req)
(define cookie-header (headers-assq* #"cookie" (request-headers/raw req))) (define cookie-header (headers-assq* #"cookie" (request-headers/raw req)))
(define cookies-alist (if cookie-header (cookie-header->alist (header-value cookie-header) bytes->string/utf-8) null)) (define cookies-alist (if cookie-header (cookie-header->alist (header-value cookie-header) bytes->string/utf-8) null))
@ -102,29 +100,16 @@
(match pair (match pair
[(cons "theme" (and theme (or "light" "dark" "default"))) [(cons "theme" (and theme (or "light" "dark" "default")))
(values 'theme (string->symbol theme))] (values 'theme (string->symbol theme))]
[(cons "notices" notices)
(values 'notices (string-split notices "|"))]
[_ (values #f #f)]))) [_ (values #f #f)])))
(user-cookies^ (user-cookies^
(hash-ref cookies-hash 'theme (user-cookies^-theme user-cookies-default)) (hash-ref cookies-hash 'theme (user-cookies^-theme user-cookies-default))))
(hash-ref cookies-hash 'notices (user-cookies^-notices user-cookies-default))))
(define (user-cookies-setter user-cookies) (define (user-cookies-setter user-cookies)
(map (λ (c) (header #"Set-Cookie" (cookie->set-cookie-header c))) (map (λ (c) (header #"Set-Cookie" (cookie->set-cookie-header c)))
(list (make-cookie "theme" (symbol->string (user-cookies^-theme user-cookies)) (list (make-cookie "theme" (symbol->string (user-cookies^-theme user-cookies))
#:path "/"
#:max-age (* 60 60 24 365 10))
(make-cookie "notices" (string-join (user-cookies^-notices user-cookies) "|")
#:path "/" #:path "/"
#:max-age (* 60 60 24 365 10))))) #:max-age (* 60 60 24 365 10)))))
(define (user-cookies-setter-url req new-settings) (define (user-cookies-setter-url req new-settings)
(format "/set-user-settings?~a" (params->query `(("next_location" . ,(url->string (request-uri req))) (format "/set-user-settings?~a" (params->query `(("next_location" . ,(url->string (request-uri req)))
("new_settings" . ,(format "~s" new-settings)))))) ("new_settings" . ,(format "~a" new-settings))))))
(define (user-cookies-setter-url/add-notice req user-cookies notice-name)
(user-cookies-setter-url
req
(struct-copy user-cookies^ user-cookies
[notices (cons notice-name (user-cookies^-notices user-cookies))])))

View file

@ -27,13 +27,6 @@
(λ (props) (λ (props)
`(p "The Square Enix Indpendent Wiki Alliance, or SEIWA, is a network of independent wikis established in 2011 and focused on providing high-quality coverage of Square Enix and its content. We work together, along with our affiliates and others, to co-operate and support one another while providing the best-quality content on the various Square Enix video games and media."))) `(p "The Square Enix Indpendent Wiki Alliance, or SEIWA, is a network of independent wikis established in 2011 and focused on providing high-quality coverage of Square Enix and its content. We work together, along with our affiliates and others, to co-operate and support one another while providing the best-quality content on the various Square Enix video games and media.")))
'GWN
(extwiki-group^
"GWN"
'(("Gaming Wiki Network" . "https://gamingwikinetwork.org/"))
(λ (props)
`(p "This wiki is part of the Gaming Wiki Network, a network of independently-hosted wikis about video game franchises. The GWN was founded on October 21, 2022. It aims to support all gaming communities in building independently-hosted wikis.")))
'Terraria 'Terraria
(extwiki-group^ (extwiki-group^
"Terraria" "Terraria"
@ -85,18 +78,11 @@
("Discussion on Reddit" . "https://old.reddit.com/r/doctorwho/comments/1azxmrl/tardis_wiki_has_regenerated/")) ("Discussion on Reddit" . "https://old.reddit.com/r/doctorwho/comments/1azxmrl/tardis_wiki_has_regenerated/"))
(λ (props) '())) (λ (props) '()))
'Rainverse
(extwiki-group^
"Rainverse"
'(("Forking announcement" . "https://transfem.social/notes/9qsqdkmqi78e01bh"))
(λ (props)
'()))
'empty 'empty
(extwiki-group^ (extwiki-group^
"Misc" "Misc"
'(("This wiki doesn't have a description yet. Add one?" . "https://docs.breezewiki.com/Reporting_Bugs.html")) '(("This wiki doesn't have a description yet. Add one?" . "https://docs.breezewiki.com/Reporting_Bugs.html"))
(λ (props) '())))) #f)))
;; wikiname, niwa-name, url, logo-url ;; wikiname, niwa-name, url, logo-url
(struct extwiki^ (wikinames banner group name home logo description) #:transparent) (struct extwiki^ (wikinames banner group name home logo description) #:transparent)
@ -330,11 +316,11 @@
(extwiki^ (extwiki^
'("zelda" "zelda-archive") 'default '("zelda" "zelda-archive") 'default
'NIWA 'NIWA
"Zelda Wiki" "Zeldapedia"
"https://zeldawiki.wiki/wiki/Main_Page" "https://zeldapedia.wiki/wiki/Main_Page"
"https://niwanetwork.org/images/logos/zeldapedia.png" "https://niwanetwork.org/images/logos/zeldapedia.png"
(λ (props) (λ (props)
`((p "Founded on April 23, 2005, Zelda Wiki is your definitive source for encyclopedic information on The Legend of Zelda series, as well as all of the latest Zelda news. Zelda Wiki went independent from Fandom in October 2022, citing Fandom's recent buyouts and staffing decisions among their reasons.")))) `((p "Founded on April 23, 2005 as Zelda Wiki, today's Zeldapedia is your definitive source for encyclopedic information on The Legend of Zelda series, as well as all of the latest Zelda news. Zeldapedia went independent from Fandom in October 2022, citing Fandom's recent buyouts and staffing decisions among their reasons."))))
(extwiki^ (extwiki^
'("chrono") 'default '("chrono") 'default
@ -443,96 +429,12 @@
(extwiki^ (extwiki^
'("tardis") 'default '("tardis") 'default
'Tardis 'Tardis
"TARDIS Wiki" "Tardis Data Core"
"https://tardis.wiki/wiki/Doctor_Who_Wiki" "https://tardis.wiki/wiki/Doctor_Who_Wiki"
"https://tardis.wiki/w/images/Tardis_Images/e/e6/Site-logo.png" "https://tardis.wiki/images/Tardis_images/e/e6/Site-logo.png"
(λ (props) (λ (props)
`())) `()))
(extwiki^
'("wizardry") 'default
'GWN
"Wizardry Wiki"
"https://wizardry.wiki.gg/wiki/Wizardry_Wiki"
"https://wizardry.wiki.gg/images/e/e6/Site-logo.png"
(λ (props)
`((p "On March 21, 2023, the wiki has decided to leave and abandoning from Fandom due to numerous of issues such as intrusive advertising, long-lasting bugs, restrictions on customization, etcetera. Wizardry Wiki was officially inducted into the wiki.gg wikifarm, with all contents forked over.")
(p "The wiki has partnered with " (a (@ (href "https://fallout.wiki/")) "Independent Fallout Wiki") " as of June 14, 2024."))))
(extwiki^
'("jackryan") 'default
'GWN
"Tom Clancy Wiki"
"https://tomclancy.wiki.gg/wiki/Tom_Clancy_Wiki"
"https://tomclancy.wiki.gg/images/thumb/c/c5/Jack_Ryan_Logo_Dark.png/600px-Jack_Ryan_Logo_Dark.png"
(λ (props)
`((p "The Tom Clancy Wiki is a collaborative encyclopedia dedicated to Tom Clancys franchises. The Tom Clancy franchise is a 40-year old expansive franchise founded by Tom Clancy, telling several unique sagas through books, video games, and films, as well as a TV show."))))
(extwiki^
'("hollowknight") 'default
'GWN
"Hollow Knight Wiki"
"https://hollowknight.wiki/wiki/Main_Page"
"https://gamingwikinetwork.org/images/logos/hollowknight.png"
(λ (props)
`((p "We are an independently hosted wiki for the games Hollow Knight and Hollow Knight: Silksong, created by fans, for fans. The wiki is a fork of the FANDOM Hollow Knight Wiki and was officially unveiled on October 31, 2023."))))
(extwiki^
'("hellokitty" "sanrio") 'default
'GWN
"Sanrio Wiki"
"https://sanriowiki.com/wiki/Sanrio_Wiki"
"https://cdn.sanriowiki.com/wiki.png"
(λ (props)
`((p "Sanrio Wiki is a project that was started on April 14, 2015 by EvieMelody. It was hosted on the wiki-farm ShoutWiki and has since become independent."))))
(extwiki^
'("sto") 'default
'GWN
"Star Trek Online Wiki"
"https://stowiki.net/wiki/Main_Page"
"https://gamingwikinetwork.org/images/logos/stowiki.png"
(λ (props)
`()))
(extwiki^
'("rayman-game" "ubisoftrayman") 'default
'GWN
"Rayman Wiki"
"https://raymanpc.com/wiki/en/Main_Page"
"https://raymanpc.com/wiki/script-en/resources/assets/logo-en.png?5c608"
(λ (props)
`()))
(extwiki^
'("granblue") 'empty
'empty
"Granblue Fantasy Wiki"
"https://gbf.wiki/"
"https://gbf.wiki/images/1/18/Vyrnball.png?0704c"
(λ (props)
`()))
(extwiki^
'("hellmet-roblox") 'empty
'empty
"HELLMET Wiki"
"https://hellmet.miraheze.org/wiki/Main_Page"
"https://static.miraheze.org/hellmetwiki/thumb/c/ce/Hellmet_Wiki_Logo.png/135px-Hellmet_Wiki_Logo.png"
(λ (props)
`()))
(extwiki^
'("rain-web-comic") 'default
'empty
"Rainverse Wiki"
"https://rainverse.wiki/wiki/Main_Page"
"https://static.miraheze.org/rainversewiki/2/2c/Rain_comic_cover.png"
(λ (props)
`((p "We have a newly-migrated Rainverse Wiki which escaped from Fandom! Rain is the comic that helped me figure out my gender, so I am really glad to have a wiki on a non-evil host.")
(p "Please stop using the abandoned copy of Rain Wiki on Fandom. Fandom is still \"training\" a generator which adds procedurally-generated bullshit to articles, with no way for users to remove or correct it, and they're demanding volunteer wiki admins waste time \"vetting\" the procedurally-generated BS for accuracy. As Jocelyn herself said, \"fuck Fandom forever.\"")
(p "If you are interested, please add more articles related to other Rainverse stories."))))
;; fandom wikinames * empty * empty * Name * Home Page ;; fandom wikinames * empty * empty * Name * Home Page
(extwiki^ '("aether") 'empty 'empty "Aether Wiki" "https://aether.wiki.gg/wiki/Aether_Wiki" #f #f) (extwiki^ '("aether") 'empty 'empty "Aether Wiki" "https://aether.wiki.gg/wiki/Aether_Wiki" #f #f)
(extwiki^ '("before-darkness-falls") 'empty 'empty "Before Darkness Falls Wiki" "https://beforedarknessfalls.wiki.gg/wiki/Before_Darkness_Falls_Wiki" #f #f) (extwiki^ '("before-darkness-falls") 'empty 'empty "Before Darkness Falls Wiki" "https://beforedarknessfalls.wiki.gg/wiki/Before_Darkness_Falls_Wiki" #f #f)
@ -548,7 +450,6 @@
(extwiki^ '("doom") 'empty 'empty "DoomWiki.org" "https://doomwiki.org/wiki/Entryway" #f #f) (extwiki^ '("doom") 'empty 'empty "DoomWiki.org" "https://doomwiki.org/wiki/Entryway" #f #f)
(extwiki^ '("dreamscaper") 'empty 'empty "Official Dreamscaper Wiki" "https://dreamscaper.wiki.gg/wiki/Dreamscaper_Wiki" #f #f) (extwiki^ '("dreamscaper") 'empty 'empty "Official Dreamscaper Wiki" "https://dreamscaper.wiki.gg/wiki/Dreamscaper_Wiki" #f #f)
(extwiki^ '("elderscrolls") 'empty 'empty "UESP" "https://en.uesp.net/wiki/Main_Page" #f #f) (extwiki^ '("elderscrolls") 'empty 'empty "UESP" "https://en.uesp.net/wiki/Main_Page" #f #f)
(extwiki^ '("enterthegungeon" "exit-the-gungeon" "enter-the-gungeon-archive") 'empty 'empty "Official Enter The Gungeon Wiki" "https://enterthegungeon.wiki.gg/wiki/Enter_the_Gungeon_Wiki" "https://enterthegungeon.wiki.gg/images/e/e6/Site-logo.png" #f)
(extwiki^ '("fiend-folio") 'empty 'empty "Official Fiend Folio Wiki" "https://fiendfolio.wiki.gg/wiki/Fiend_Folio_Wiki" #f #f) (extwiki^ '("fiend-folio") 'empty 'empty "Official Fiend Folio Wiki" "https://fiendfolio.wiki.gg/wiki/Fiend_Folio_Wiki" #f #f)
(extwiki^ '("foxhole") 'empty 'empty "Foxhole Wiki" "https://foxhole.wiki.gg/wiki/Foxhole_Wiki" #f #f) (extwiki^ '("foxhole") 'empty 'empty "Foxhole Wiki" "https://foxhole.wiki.gg/wiki/Foxhole_Wiki" #f #f)
(extwiki^ '("have-a-nice-death") 'empty 'empty "Have a Nice Death Wiki" "https://haveanicedeath.wiki.gg/wiki/Have_a_Nice_Death_Wiki" #f #f) (extwiki^ '("have-a-nice-death") 'empty 'empty "Have a Nice Death Wiki" "https://haveanicedeath.wiki.gg/wiki/Have_a_Nice_Death_Wiki" #f #f)

View file

@ -1,16 +1,12 @@
#lang typed/racket/base #lang typed/racket/base
(require racket/format (require "config.rkt"
racket/string
"config.rkt"
"../lib/url-utils.rkt") "../lib/url-utils.rkt")
(define-type Headers (HashTable Symbol (U Bytes String))) (define-type Headers (HashTable Symbol (U Bytes String)))
(require/typed net/http-easy (require/typed net/http-easy
[#:opaque Timeout-Config timeout-config?] [#:opaque Timeout-Config timeout-config?]
[#:opaque Response response?] [#:opaque Response response?]
[#:opaque Session session?] [#:opaque Session session?]
[response-status-code (Response -> Natural)]
[current-session (Parameter Session)] [current-session (Parameter Session)]
[current-user-agent (Parameter (U Bytes String))]
[make-timeout-config ([#:lease Positive-Real] [#:connect Positive-Real] -> Timeout-Config)] [make-timeout-config ([#:lease Positive-Real] [#:connect Positive-Real] -> Timeout-Config)]
[get ((U Bytes String) [get ((U Bytes String)
[#:close? Boolean] [#:close? Boolean]
@ -26,41 +22,19 @@
fandom-get-api fandom-get-api
timeouts) timeouts)
(unless (string-contains? (~a (current-user-agent)) "BreezeWiki")
(current-user-agent
(format "BreezeWiki/1.0 (~a) ~a"
(if (config-true? 'canonical_origin)
(config-get 'canonical_origin)
"local")
(current-user-agent))))
(define timeouts (make-timeout-config #:lease 5 #:connect 5)) (define timeouts (make-timeout-config #:lease 5 #:connect 5))
(: last-failure Flonum)
(define last-failure 0.0)
(: stored-failure (Option Response))
(define stored-failure #f)
(define failure-persist-time 30000)
(: no-headers Headers) (: no-headers Headers)
(define no-headers '#hasheq()) (define no-headers '#hasheq())
(: fandom-get (String String [#:headers (Option Headers)] -> Response)) (: fandom-get (String String [#:headers (Option Headers)] -> Response))
(define (fandom-get wikiname path #:headers [headers #f]) (define (fandom-get wikiname path #:headers [headers #f])
(or
(and ((current-inexact-milliseconds) . < . (+ last-failure failure-persist-time)) stored-failure)
(let ()
(define dest-url (string-append "https://www.fandom.com" path)) (define dest-url (string-append "https://www.fandom.com" path))
(define host (string-append wikiname ".fandom.com")) (define host (string-append wikiname ".fandom.com"))
(log-outgoing wikiname path) (log-outgoing wikiname path)
(define res
(get dest-url (get dest-url
#:timeouts timeouts #:timeouts timeouts
#:headers (hash-set (or headers no-headers) 'Host host))) #:headers (hash-set (or headers no-headers) 'Host host)))
(when (memq (response-status-code res) '(403 406))
(set! last-failure (current-inexact-milliseconds))
(set! stored-failure res))
res)))
(: fandom-get-api (String (Listof (Pair String String)) [#:headers (Option Headers)] -> Response)) (: fandom-get-api (String (Listof (Pair String String)) [#:headers (Option Headers)] -> Response))
(define (fandom-get-api wikiname params #:headers [headers #f]) (define (fandom-get-api wikiname params #:headers [headers #f])

View file

@ -18,7 +18,6 @@
"config.rkt" "config.rkt"
"data.rkt" "data.rkt"
"fandom-request.rkt" "fandom-request.rkt"
"../lib/archive-file-mappings.rkt"
"../lib/pure-utils.rkt" "../lib/pure-utils.rkt"
"../lib/syntax.rkt" "../lib/syntax.rkt"
"../lib/thread-utils.rkt" "../lib/thread-utils.rkt"
@ -38,9 +37,8 @@
(define (page-wiki req) (define (page-wiki req)
(define wikiname (path/param-path (first (url-path (request-uri req))))) (define wikiname (path/param-path (first (url-path (request-uri req)))))
(define segments (map path/param-path (cdr (url-path (request-uri req)))))
(define user-cookies (user-cookies-getter req)) (define user-cookies (user-cookies-getter req))
(define path (string-join (cdr segments) "/")) (define path (string-join (map path/param-path (cddr (url-path (request-uri req)))) "/"))
(define source-url (format "https://~a.fandom.com/wiki/~a" wikiname path)) (define source-url (format "https://~a.fandom.com/wiki/~a" wikiname path))
(define-values (dest-res siteinfo) (define-values (dest-res siteinfo)
@ -103,31 +101,9 @@
(write-html body out))))))] (write-html body out))))))]
[(eq? 404 (easy:response-status-code dest-res)) [(eq? 404 (easy:response-status-code dest-res))
(next-dispatcher)] (next-dispatcher)]
[(memq (easy:response-status-code dest-res) '(403 406))
(response-handler
(define body
(generate-wiki-page
`(div
(p "Sorry! Fandom isn't allowing BreezeWiki to show pages right now.")
(p "We'll automatically try again in 30 seconds, so please stay on this page and be patient.")
(p (small "In a hurry? " (a (@ (href ,source-url)) "Click here to read the page on Fandom."))))
#:req req
#:source-url source-url
#:wikiname wikiname
#:title (url-segments->guess-title segments)
#:siteinfo siteinfo))
(response/output
#:code 503
#:headers (build-headers
always-headers
(header #"Retry-After" #"30")
(header #"Cache-Control" #"max-age=30, public")
(header #"Refresh" #"35"))
(λ (out)
(write-html body out))))]
[else [else
(response-handler (response-handler
(error 'page-wiki "Tried to load page ~a/~a~nSadly, the page didn't load because Fandom returned status code ~a with response:~n~a" (error 'page-wiki "Tried to load page ~a/~v~nSadly, the page didn't load because Fandom returned status code ~a with response:~n~a"
wikiname wikiname
path path
(easy:response-status-code dest-res) (easy:response-status-code dest-res)

View file

@ -431,25 +431,6 @@ a.ext-audiobutton { /* see hearthstone/wiki/Diablo_(Duels_hero) */
font-size: 14px; font-size: 14px;
text-align: right; text-align: right;
} }
/* more compact notice after it's been seen the first time */
.niwa--seen {
padding: 1.5vw 2vw 2vw;
overflow-y: auto;
max-height: min(280px, 33vh);
font-size: 17px;
margin-top: -2vw;
margin-bottom: 12px;
}
.niwa--seen .niwa__header {
font-size: 26px;
}
.niwa--seen .niwa__go {
padding: 10px 18px;
font-size: 20px;
}
.niwa--seen .niwa__got-it {
display: none;
}
/* media queries */ /* media queries */