forked from cadence/breezewiki
Compare commits
5 commits
4968dc2a49
...
71705d6e74
Author | SHA1 | Date | |
---|---|---|---|
71705d6e74 | |||
722b0589cb | |||
9c05e95f07 | |||
2e6fa6088b | |||
5b4efdd292 |
8 changed files with 33 additions and 8 deletions
|
@ -12,6 +12,7 @@
|
||||||
(require-reloadable "src/page-category.rkt" page-category)
|
(require-reloadable "src/page-category.rkt" page-category)
|
||||||
(require-reloadable "src/page-global-search.rkt" page-global-search)
|
(require-reloadable "src/page-global-search.rkt" page-global-search)
|
||||||
(require-reloadable "src/page-home.rkt" page-home)
|
(require-reloadable "src/page-home.rkt" page-home)
|
||||||
|
(require-reloadable "src/page-it-works.rkt" page-it-works)
|
||||||
(require-reloadable "src/page-not-found.rkt" page-not-found)
|
(require-reloadable "src/page-not-found.rkt" page-not-found)
|
||||||
(require-reloadable "src/page-proxy.rkt" page-proxy)
|
(require-reloadable "src/page-proxy.rkt" page-proxy)
|
||||||
(require-reloadable "src/page-redirect-wiki-home.rkt" redirect-wiki-home)
|
(require-reloadable "src/page-redirect-wiki-home.rkt" redirect-wiki-home)
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
page-category
|
page-category
|
||||||
page-global-search
|
page-global-search
|
||||||
page-home
|
page-home
|
||||||
|
page-it-works
|
||||||
page-not-found
|
page-not-found
|
||||||
page-proxy
|
page-proxy
|
||||||
page-search
|
page-search
|
||||||
|
|
2
dist.rkt
2
dist.rkt
|
@ -6,6 +6,7 @@
|
||||||
(require (only-in "src/page-category.rkt" page-category))
|
(require (only-in "src/page-category.rkt" page-category))
|
||||||
(require (only-in "src/page-global-search.rkt" page-global-search))
|
(require (only-in "src/page-global-search.rkt" page-global-search))
|
||||||
(require (only-in "src/page-home.rkt" page-home))
|
(require (only-in "src/page-home.rkt" page-home))
|
||||||
|
(require (only-in "src/page-it-works.rkt" page-it-works))
|
||||||
(require (only-in "src/page-not-found.rkt" page-not-found))
|
(require (only-in "src/page-not-found.rkt" page-not-found))
|
||||||
(require (only-in "src/page-proxy.rkt" page-proxy))
|
(require (only-in "src/page-proxy.rkt" page-proxy))
|
||||||
(require (only-in "src/page-redirect-wiki-home.rkt" redirect-wiki-home))
|
(require (only-in "src/page-redirect-wiki-home.rkt" redirect-wiki-home))
|
||||||
|
@ -24,6 +25,7 @@
|
||||||
page-category
|
page-category
|
||||||
page-global-search
|
page-global-search
|
||||||
page-home
|
page-home
|
||||||
|
page-it-works
|
||||||
page-not-found
|
page-not-found
|
||||||
page-proxy
|
page-proxy
|
||||||
page-search
|
page-search
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
(pathprocedure:make "/" (hash-ref ds 'page-home))
|
(pathprocedure:make "/" (hash-ref ds 'page-home))
|
||||||
(pathprocedure:make "/proxy" (hash-ref ds 'page-proxy))
|
(pathprocedure:make "/proxy" (hash-ref ds 'page-proxy))
|
||||||
(pathprocedure:make "/search" (hash-ref ds 'page-global-search))
|
(pathprocedure:make "/search" (hash-ref ds 'page-global-search))
|
||||||
|
(pathprocedure:make "/buddyfight/wiki/It_Doesn't_Work!!" (hash-ref ds 'page-it-works))
|
||||||
(filter:make (pregexp (format "^/~a/wiki/Category:.+$" px-wikiname)) (lift:make (hash-ref ds 'page-category)))
|
(filter:make (pregexp (format "^/~a/wiki/Category:.+$" px-wikiname)) (lift:make (hash-ref ds 'page-category)))
|
||||||
(filter:make (pregexp (format "^/~a/wiki/File:.+$" px-wikiname)) (lift:make (hash-ref ds 'page-file)))
|
(filter:make (pregexp (format "^/~a/wiki/File:.+$" px-wikiname)) (lift:make (hash-ref ds 'page-file)))
|
||||||
(filter:make (pregexp (format "^/~a/wiki/.+$" px-wikiname)) (lift:make (hash-ref ds 'page-wiki)))
|
(filter:make (pregexp (format "^/~a/wiki/.+$" px-wikiname)) (lift:make (hash-ref ds 'page-wiki)))
|
||||||
|
|
|
@ -31,8 +31,7 @@
|
||||||
(rawImageUrl . "https://static.wikia.nocookie.net/examplefile")
|
(rawImageUrl . "https://static.wikia.nocookie.net/examplefile")
|
||||||
(userName . "blankie")
|
(userName . "blankie")
|
||||||
(isPostedIn . #t)
|
(isPostedIn . #t)
|
||||||
(smallerArticleList . (#hasheq((title . "Example_article")
|
(smallerArticleList . (#hasheq((titleText . "Test:Example article"))))
|
||||||
(titleText . "Example article"))))
|
|
||||||
(articleListIsSmaller . 0)
|
(articleListIsSmaller . 0)
|
||||||
(exists . #t)
|
(exists . #t)
|
||||||
(imageDescription . #f))))
|
(imageDescription . #f))))
|
||||||
|
@ -89,8 +88,8 @@
|
||||||
,(if is-posted-in
|
,(if is-posted-in
|
||||||
`(p "This file is used in "
|
`(p "This file is used in "
|
||||||
,@(map (λ (article)
|
,@(map (λ (article)
|
||||||
(define page-path (jp "/title" article))
|
(define title (jp "/titleText" article))
|
||||||
(define title (jp "/titleText" article page-path))
|
(define page-path (regexp-replace* #rx" " title "_"))
|
||||||
`(span ,(if (eq? (car smaller-article-list) article) "" ", ")
|
`(span ,(if (eq? (car smaller-article-list) article) "" ", ")
|
||||||
(a (@ (href ,(format "/~a/wiki/~a" wikiname page-path)))
|
(a (@ (href ,(format "/~a/wiki/~a" wikiname page-path)))
|
||||||
,title)))
|
,title)))
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
,(apply format "~a: ~a" x))))
|
,(apply format "~a: ~a" x))))
|
||||||
examples))
|
examples))
|
||||||
(h2 "Testimonials")
|
(h2 "Testimonials")
|
||||||
(p (@ (class "testimonial")) ">So glad to never have to touch fandom's garbage platform directly ever again —RNL")
|
(p (@ (class "testimonial")) ">so glad someone introduced me to a F*ndom alternative (BreezeWiki) because that x-factorized spillway of an ad-infested radioactive dumpsite can go die in a fire —RB")
|
||||||
(p (@ (class "testimonial")) ">you are so right that fandom still sucks even with adblock somehow. even zapping all the stupid padding it still sucks —Minimus")
|
(p (@ (class "testimonial")) ">you are so right that fandom still sucks even with adblock somehow. even zapping all the stupid padding it still sucks —Minimus")
|
||||||
(p (@ (class "testimonial")) ">attempting to go to a wiki's forum page with breezewiki doesn't work, which is based honestly —Tom Skeleton")
|
(p (@ (class "testimonial")) ">attempting to go to a wiki's forum page with breezewiki doesn't work, which is based honestly —Tom Skeleton")
|
||||||
(p (@ (class "testimonial")) ">Fandom pages crashing and closing, taking forever to load and locking up as they load the ads on the site... they are causing the site to crash because they are trying to load video ads both at the top and bottom of the site as well as two or three banner ads, then a massive top of site ad and eventually my anti-virus shuts the whole site down because it's literally pulling more resources than WoW in ultra settings... —Anonymous")
|
(p (@ (class "testimonial")) ">Fandom pages crashing and closing, taking forever to load and locking up as they load the ads on the site... they are causing the site to crash because they are trying to load video ads both at the top and bottom of the site as well as two or three banner ads, then a massive top of site ad and eventually my anti-virus shuts the whole site down because it's literally pulling more resources than WoW in ultra settings... —Anonymous")
|
||||||
|
|
15
src/page-it-works.rkt
Normal file
15
src/page-it-works.rkt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#lang racket/base
|
||||||
|
(require racket/dict
|
||||||
|
net/url
|
||||||
|
web-server/http
|
||||||
|
web-server/dispatchers/dispatch
|
||||||
|
"application-globals.rkt")
|
||||||
|
|
||||||
|
(provide
|
||||||
|
page-it-works)
|
||||||
|
|
||||||
|
(define (page-it-works req)
|
||||||
|
(define b? (dict-ref (url-query (request-uri req)) 'b #f))
|
||||||
|
(if b?
|
||||||
|
(generate-redirect "/stampylongnose/wiki/It_Works")
|
||||||
|
(next-dispatcher)))
|
|
@ -52,7 +52,7 @@
|
||||||
(a (@ (data-test-wikilink) (href "https://test.fandom.com/wiki/Another_Page") (title "Another Page"))
|
(a (@ (data-test-wikilink) (href "https://test.fandom.com/wiki/Another_Page") (title "Another Page"))
|
||||||
"Another Page"))))
|
"Another Page"))))
|
||||||
(figure (@ (class "thumb tnone"))
|
(figure (@ (class "thumb tnone"))
|
||||||
(a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image"))
|
(a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image") (data-test-figure-a))
|
||||||
(img (@ (src "data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D")
|
(img (@ (src "data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D")
|
||||||
(data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
|
(data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
|
||||||
(class "thumbimage lazyload"))))
|
(class "thumbimage lazyload"))))
|
||||||
|
@ -188,7 +188,8 @@
|
||||||
(λ (v)
|
(λ (v)
|
||||||
(and (config-true? 'strict_proxy)
|
(and (config-true? 'strict_proxy)
|
||||||
(eq? element-type 'a)
|
(eq? element-type 'a)
|
||||||
(has-class? "image-thumbnail" v)))
|
(or (has-class? "image-thumbnail" v)
|
||||||
|
(has-class? "image" v))))
|
||||||
(λ (v) (attribute-maybe-update 'href u-proxy-url v)))
|
(λ (v) (attribute-maybe-update 'href u-proxy-url v)))
|
||||||
; proxy images from src attributes, if strict_proxy is set
|
; proxy images from src attributes, if strict_proxy is set
|
||||||
(curry u
|
(curry u
|
||||||
|
@ -254,6 +255,11 @@
|
||||||
(λ (t a c) (and (eq? t 'a) (has-class? "image-thumbnail" a)))
|
(λ (t a c) (and (eq? t 'a) (has-class? "image-thumbnail" a)))
|
||||||
transformed))))
|
transformed))))
|
||||||
"/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png")
|
"/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png")
|
||||||
|
(check-equal? (get-attribute 'href (bits->attributes
|
||||||
|
((query-selector
|
||||||
|
(λ (t a c) (member '(data-test-figure-a) a))
|
||||||
|
transformed))))
|
||||||
|
"/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png")
|
||||||
; check that noscript images are removed
|
; check that noscript images are removed
|
||||||
(check-equal? ((query-selector (λ (t a c) (eq? t 'noscript)) transformed)) #f))
|
(check-equal? ((query-selector (λ (t a c) (eq? t 'noscript)) transformed)) #f))
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
(module+ test
|
(module+ test
|
||||||
(require "typed-rackunit.rkt"))
|
(require "typed-rackunit.rkt"))
|
||||||
|
|
||||||
(define px-wikiname "[a-zA-Z0-9-]{3,50}")
|
(define px-wikiname "[a-zA-Z0-9-]{1,50}")
|
||||||
|
|
||||||
;; https://url.spec.whatwg.org/#urlencoded-serializing
|
;; https://url.spec.whatwg.org/#urlencoded-serializing
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue