")
- '(*TOP* (div (details (p "text in details"))))))
-
- ;; TODO: 2022-01-22 Go through latest HTML elements and add them to parent constraints
- ;; in the ancient quirks handling from over 20 years ago.
-
- (test-section 'p-elem-cannot-be-child-of-p-elem
-
- (test 'initial-simpson-example
- (html->xexp "
")
- '(*TOP* (figcaption " "
- (p (@ (class "caption")) "words")
- (img (@ (src "nowhere"))))))
-
- (test 'attribute-html-entities-1
- (html->xexp "")
- '(*TOP* (img (@ (src "https://example.com/images?src=Blah.jpg&width=150")))))
-
- (test 'attribute-html-entities-2
- (html->xexp "https://example.com/phpbb/viewtopic.php?f=31&t=1125")
- '(*TOP* (a (@ (href "https://example.com/phpbb/viewtopic.php?f=31&t=1125"))
- "https://example.com/phpbb/viewtopic.php?f=31&t=1125"))))
-
- ;; TODO: Document this.
- ;;
- ;; (define html-1 "")
- ;; (define shtml (html->xexp html-1))
- ;; shtml
- ;; (define html-2 (shtml->html shtml))
- ;; html-2
- )
-
-(doc history
-
- (#:planet 12:0 #:date "2023-01-28"
- (itemlist
- (item "Within attributes, HTML entities like & are now decoded.")
- (item "A "
- (code "p")
- " element can now appear as a child of a "
- (code "figcaption")
- " element.")))
-
- (#:planet 11:0 #:date "2022-07-19"
- (itemlist
- (item "An "
- (code "object")
- " element is no longer considered always-empty. Incrementing major
-version again, because this could break parses.")))
-
- (#:planet 10:0 #:date "2022-07-19"
- (itemlist
- (item "To pass a \"microformats\" test suite ("
- (hyperlink "https://github.com/microformats/tests/blob/master/tests/microformats-v2/h-card/impliedname.html#L11"
- "impliedname.html")
- "), an "
- (code "area")
- " element can now be a child of a "
- (code "span")
- " element. In the future, we might be even more flexible about where "
- (code "span")
- " elements are permitted. (Thanks to Jacob Hall for
-discussing.)")))
-
- (#:planet 9:0 #:date "2022-04-16"
- (itemlist
- (item "Header elements may once again appear as children of "
- (code "li")
- " elements (which we broke in the previous version), as we see how far we can stretch a 20 year-old hack for invalid HTML. (Thanks for Simon Budinsky for reporting.)")))
-
- (#:planet 8:0 #:date "2022-04-03"
- (itemlist
- (item "The original \"H\" elements ("
- (code "h1")
- ", "
- (code "h2")
- ", etc.) now are parsed with \"parent constraints\" for
-handling invalid HTML, to accommodate a need to parse mid-1990s HTML in which "
- (code "
")
- " was used as a separator or terminator, rather than a
-start delimeter. There is a chance that change this will break a real-world
-scraper or other tool.")))
-
- (#:planet 7:1 #:date "2022-04-02"
- (itemlist
- (item "Include a test case #:fail that was unsaved in DrRacket.")))
-
- (#:planet 7:0 #:date "2022-04-02"
- (itemlist
-
- (item "Fixed a quirks-handling bug in which "
- (code "p")
- " elements would be (directly or indirectly) nested under other "
- (code "p")
- " elements in cases in which there was no "
- (code "body")
- " element, but there was an "
- (code "html")
- " element. (Thanks to Jonathan Simpson for reporting.)")))
-
- (#:planet 6:1 #:date "2022-01-22"
- (itemlist
- (item "Permit "
- (code "details")
- " element to be parent of "
- (code "p")
- " element in quirks handling. (Thanks to Jacder for reporting.)")))
-
- (#:planet 6:0 #:date "2018-05-22"
- (itemlist
- (item "Fix to permit "
- (code "p")
- " elements as children of "
- (code "blockquote")
- " elements. Incrementing major version number because
-this is a breaking change of 17 years, but seems an appropriate change for
-modern HTML, and fixes a particular real-world problem. (Thanks to
-Sorawee Porncharoenwase for reporting.)")))
-
- (#:planet 5:0 #:date "2018-05-15"
- (itemlist
- (item "In a breaking change of handing invalid HTML, most named
-character entity references that are invalid because (possibly among multiple
-reasons) they are not terminated by semicolon, now are treated as literal
-strings (including the ampersand), rather than as named character entites. For
-example, parser input string "
- (racket "
A&B Co.
")
- " will now parse as "
- (racket (p "A&B Co."))
- " rather than as "
- (racket (p "A" (& B) " Co."))
- ". (Thanks for Greg Hendershott for suggesting this, and discussing.)")
- (item "For support of historical quirks handling, five early
-HTML named character entities (specifically, "
- (tt "amp")
- ", "
- (tt "apos")
- ", "
- (tt "lt")
- ", "
- (tt "gt")
- ", "
- (tt "quot")
- ") do not need to be terminated with a semicolon, and
-will even be recognized if followed immediately by an alphabetic. For
-example, "
- (racket "
a<z
")
- " will now parse as "
- (racket (p "amime-type (-> bytes? bytes?)]
- [mime-type->ext (-> bytes? bytes?)]))
-
-(define-runtime-path mime.types-path "mime.types")
-
-(define ls
- (call-with-input-file mime.types-path
- (λ (in) (for/list ([line (in-lines in)]
- #:when (not (regexp-match? #rx"^ *($|#)" line)))
- (match line
- [(regexp #rx"^([^ ]+) +(.+)$" (list _ mime ext))
- (cons (string->bytes/utf-8 ext) (string->bytes/utf-8 mime))]
- [(regexp #rx"^ *#") (void)]
- [_ (log-warning "mime-types: failed to parse line ~s" line)])))))
-
-(define forward-hash (make-immutable-hash ls))
-(define reverse-hash (make-immutable-hash (map (λ (x) (cons (cdr x) (car x))) ls)))
-
-(define (ext->mime-type ext-in)
- (define ext (regexp-replace #rx"^\\." ext-in #""))
- (hash-ref forward-hash ext))
-
-(define (mime-type->ext m-in)
- (define m (regexp-replace #rx";.*" m-in #""))
- (hash-ref reverse-hash m))
diff --git a/lib/mime.types b/lib/mime.types
deleted file mode 100644
index 4ae48d8..0000000
--- a/lib/mime.types
+++ /dev/null
@@ -1,90 +0,0 @@
-text/html html
-text/css css
-application/xml xml
-text/xml xml
-image/gif gif
-image/jpeg jpeg
-application/javascript js
-text/javascript js
-application/atom+xml atom
-application/rss+xml rss
-
-text/mathml mml
-text/plain txt
-text/x-component htc
-
-image/png png
-image/tiff tiff
-image/vnd.wap.wbmp wbmp
-image/x-icon ico
-image/vnd.microsoft.icon ico
-image/x-jng jng
-image/x-ms-bmp bmp
-image/svg+xml svg
-image/webp webp
-image/avif avif
-
-application/font-woff2 woff2
-application/acad woff2
-font/woff2 woff2
-application/font-woff woff
-font/woff woff
-application/x-font-ttf ttf
-application/x-font-truetype ttf
-application/x-truetype-font ttf
-font/ttf ttf
-application/font-sfnt ttf
-font/sfnt ttf
-application/vnd.oasis.opendocument.formula-template otf
-application/x-font-opentype otf
-application/vnd.ms-opentype otf
-font/otf otf
-application/java-archive jar
-application/json json
-application/mac-binhex40 hqx
-application/msword doc
-application/pdf pdf
-application/postscript ps
-application/rtf rtf
-application/vnd.apple.mpegurl m3u8
-application/vnd.ms-excel xls
-application/vnd.ms-fontobject eot
-application/vnd.ms-powerpoint ppt
-application/vnd.wap.wmlc wmlc
-application/vnd.google-earth.kml+xml kml
-application/vnd.google-earth.kmz kmz
-application/x-7z-compressed 7z
-application/x-cocoa cco
-application/x-java-archive-diff jardiff
-application/x-java-jnlp-file jnlp
-application/x-makeself run
-application/x-perl pl
-application/x-rar-compressed rar
-application/x-redhat-package-manager rpm
-application/x-sea sea
-application/x-shockwave-flash swf
-application/x-stuffit sit
-application/x-tcl tcl
-application/x-x509-ca-cert pem
-application/x-xpinstall xpi
-application/xhtml+xml xhtml
-application/xspf+xml xspf
-application/zip zip
-application/gzip gz
-
-audio/midi mid midi kar
-audio/mpeg mp3
-audio/ogg ogg
-audio/x-m4a m4a
-audio/x-realaudio ra
-
-video/mp2t ts
-video/mp4 mp4
-video/mpeg mpeg
-video/quicktime mov
-video/webm webm
-video/x-flv flv
-video/x-m4v m4v
-video/x-mng mng
-video/x-ms-wmv wmv
-video/x-msvideo avi
diff --git a/lib/syntax.rkt b/lib/syntax.rkt
deleted file mode 100644
index 650e2f5..0000000
--- a/lib/syntax.rkt
+++ /dev/null
@@ -1,148 +0,0 @@
-#lang racket/base
-(require (for-syntax racket/base syntax/location))
-
-(provide
- ; help make a nested if. if/in will gain the same false form of its containing if/out.
- if/out
- ; cond, but values can be defined between conditions
- cond/var
- ; wrap sql statements into lambdas so they can be executed during migration
- wrap-sql
- ; get the name of the file that contains the currently evaluating form
- this-directory
- this-file
- ; replacement for define-runtime-path
- anytime-path)
-
-(module+ test
- (require rackunit)
- (define (check-syntax-equal? s1 s2)
- (check-equal? (syntax->datum s1)
- (syntax->datum s2))))
-
-;; actual transforming goes on in here.
-;; it's in a submodule so that it can be required in both levels, for testing
-
-(module transform racket/base
- (require racket/list)
-
- (provide
- transform-if/out
- transform/out-cond/var)
-
- (define (transform-if/out stx)
- (define tree (cdr (syntax->datum stx))) ; condition true false
- (define else (cddr tree)) ; the else branch cons cell
- (define result
- (let walk ([node tree])
- (cond
- ; normally, node should be a full cons cell (a pair) but it might be something else.
- ; situation: reached the end of a list, empty cons cell
- [(null? node) node]
- ; situation: reached the end of a list, cons cdr was non-list
- [(symbol? node) node]
- ; normal situation, full cons cell
- ; -- don't go replacing through nested if/out
- [(and (pair? node) (eq? 'if/out (car node))) node]
- ; -- replace if/in
- [(and (pair? node) (eq? 'if/in (car node)))
- (append '(if) (walk (cdr node)) else)]
- ; recurse down pair head and tail
- [(pair? node) (cons (walk (car node)) (walk (cdr node)))]
- ; something else that can't be recursed into, so pass it through
- [#t node])))
- (datum->syntax stx (cons 'if result)))
-
- (define (transform/out-cond/var stx)
- (define tree (transform-cond/var (cdr (syntax->datum stx))))
- (datum->syntax
- stx
- tree))
-
- (define (transform-cond/var tree)
- (define-values (els temp) (splitf-at tree (λ (el) (and (pair? el) (not (eq? (car el) 'var))))))
- (define-values (vars rest) (splitf-at temp (λ (el) (and (pair? el) (eq? (car el) 'var)))))
- (if (null? rest)
- `(cond ,@els)
- `(cond
- ,@els
- [#t
- (let* ,(for/list ([var vars])
- (cdr var))
- ,(transform-cond/var rest))]))))
-
-;; the syntax definitions and their tests go below here
-
-(require 'transform (for-syntax 'transform))
-
-(define-syntax (wrap-sql stx)
- ; the arguments
- (define xs (cdr (syntax->list stx)))
- ; wrap each argument
- (define wrapped (map (λ (xe) ; xe is the syntax of an argument
- (if (list? (car (syntax->datum xe)))
- ; it's a list of lists (a list of sql migration steps)
- ; return instead syntax of a lambda that will call everything in xe
- (datum->syntax stx `(λ () ,@xe))
- ; it's just a single sql migration step
- ; return instead syntax of a lambda that will call xe
- (datum->syntax stx `(λ () ,xe))))
- xs))
- ; since I'm returning *code*, I need to return the form (list ...) so that runtime makes a list
- (datum->syntax stx `(list ,@wrapped)))
-
-(define-syntax (if/out stx)
- (transform-if/out stx))
-(module+ test
- (check-syntax-equal? (transform-if/out #'(if/out (condition 1) (if/in (condition 2) (do-yes)) (do-no)))
- #'(if (condition 1) (if (condition 2) (do-yes) (do-no)) (do-no)))
- (check-equal? (if/out #t (if/in #t 'yes) 'no) 'yes)
- (check-equal? (if/out #f (if/in #t 'yes) 'no) 'no)
- (check-equal? (if/out #t (if/in #f 'yes) 'no) 'no)
- (check-equal? (if/out #f (if/in #f 'yes) 'no) 'no))
-
-(define-syntax (this-directory stx)
- (datum->syntax stx (syntax-source-directory stx)))
-
-(define-syntax (this-file stx)
- (datum->syntax stx (build-path (or (syntax-source-directory stx) 'same) (syntax-source-file-name stx))))
-
-(module+ test
- (require racket/path)
- (check-equal? (file-name-from-path (this-file)) (build-path "syntax.rkt")))
-
-(define-syntax (cond/var stx)
- (transform/out-cond/var stx))
-(module+ test
- (check-syntax-equal? (transform/out-cond/var #'(cond/def [#f 0] (var d (* a 2)) [(eq? d 8) d] [#t "not 4"]))
- #'(cond
- [#f 0]
- [#t
- (let* ([d (* a 2)])
- (cond
- [(eq? d 8) d]
- [#t "not 4"]))])))
-
-;;; Replacement for define-runtime-path that usually works well and doesn't include the files/folder contents into the distribution.
-;;; When running from source, should always work appropriately.
-;;; When running from a distribution, (current-directory) is treated as the root.
-;;; Usage:
-;;; * to-root : Path-String * relative path from the source file to the project root
-;;; * to-dest : Path-String * relative path from the root to the desired file/folder
-(define-syntax (anytime-path stx)
- (define-values (_ to-root to-dest) (apply values (syntax->list stx)))
- (define source (syntax-source stx))
- (unless (complete-path? source)
- (error 'anytime-path "syntax source has no directory: ~v" stx))
- (datum->syntax
- stx
- `(let* ([source ,source]
- [dir-of-source (path-only source)]
- [_ (unless (path? dir-of-source) (error 'anytime-path "syntax source has no directory: ~v" ,source))]
- [syntax-to-root (build-path dir-of-source ,to-root)]
- [root (if (directory-exists? syntax-to-root)
- ;; running on the same filesystem it was compiled on, i.e. it's running the source code out of a directory, and the complication is the intermediate compilation
- syntax-to-root
- ;; not running on the same filesystem, i.e. it's a distribution. we assume that the current working directory is where the executable is, and treat this as the root.
- (current-directory))])
- (simple-form-path (build-path root ,to-dest)))))
diff --git a/lib/thread-utils.rkt b/lib/thread-utils.rkt
deleted file mode 100644
index 66e2b4c..0000000
--- a/lib/thread-utils.rkt
+++ /dev/null
@@ -1,71 +0,0 @@
-#lang racket/base
-(require "../src/data.rkt"
- "xexpr-utils.rkt")
-
-(provide
- thread-values)
-
-(module+ test
- (require rackunit))
-
-(define (thread-values . thunks)
- (parameterize-break #t
- (define the-exn (box #f))
- (define original-thread (current-thread))
- (define (break e)
- (when (box-cas! the-exn #f e)
- (break-thread original-thread))
- (sleep 0))
- (define-values (threads channels)
- (for/fold ([ts null]
- [chs null]
- #:result (values (reverse ts) (reverse chs)))
- ([th thunks])
- (define ch (make-channel))
- (define t
- (thread (λ ()
- (with-handlers ([exn? break])
- (channel-put ch (th))))))
- (values (cons t ts) (cons ch chs))))
- (apply
- values
- (with-handlers ([exn:break? (λ (_)
- (for ([t threads]) (kill-thread t))
- (if (unbox the-exn)
- (raise (unbox the-exn))
- (error 'thread-values "a thread broke, but without reporting its exception")))])
- (for/list ([ch channels])
- (channel-get ch))))))
-
-(module+ test
- ; check that they actually execute concurrently
- (define ch (make-channel))
- (check-equal? (let-values ([(a b)
- (thread-values
- (λ ()
- (begin
- (channel-put ch 'a)
- (channel-get ch)))
- (λ ()
- (begin0
- (channel-get ch)
- (channel-put ch 'b))))])
- (list a b))
- '(b a))
- ; check that it assigns the correct value to the correct variable
- (check-equal? (let-values ([(a b)
- (thread-values
- (λ () (sleep 0) 'a)
- (λ () 'b))])
- (list a b))
- '(a b))
- ; check that exceptions are passed to the original thread, and other threads are killed
- ;; TODO: if the other thread was making an HTTP request, could it be left stuck open by the kill?
- (check-equal? (let* ([x "!"]
- [res
- (with-handlers ([exn:fail:user? (λ (e) (exn-message e))])
- (thread-values
- (λ () (sleep 0) (set! x "?") (println "this side effect should not happen"))
- (λ () (raise-user-error "catch me"))))])
- (string-append res x))
- "catch me!"))
diff --git a/lib/tree-updater.rkt b/lib/tree-updater.rkt
deleted file mode 100644
index 109c875..0000000
--- a/lib/tree-updater.rkt
+++ /dev/null
@@ -1,330 +0,0 @@
-#lang racket/base
-(require racket/dict
- racket/function
- racket/match
- racket/string
- "pure-utils.rkt"
- "url-utils.rkt"
- "xexpr-utils.rkt")
-
-(provide
- preprocess-html-wiki
- update-tree-wiki)
-
-(define (preprocess-html-wiki html)
- (regexp-replace* #rx"(<(?:td|figcaption)[^>]*?>\n?)(?:
")))))
-
-(module+ test
- (check-equal? (preprocess-html-wiki "
\n
Hey
")
- "
\n
Hey
")
- (check-equal? (preprocess-html-wiki "
Caption text.
")
- "Caption text."))
-
-(module+ test
- (require rackunit
- "html-parsing/main.rkt")
- (define wiki-document
- '(*TOP*
- (div (@ (class "mw-parser-output"))
- (aside (@ (role "region") (class "portable-infobox pi-theme-wikia pi-layout-default"))
- (h2 (@ (class "pi-item pi-title") (data-source "title"))
- "Infobox Title")
- (figure (@ (class "pi-item pi-image") (data-source "image"))
- (a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image image-thumbnail") (title ""))
- (img (@ (src "https://static.wikia.nocookie.net/nice-image-thumbnail.png") (class "pi-image-thumbnail")))))
- (div (@ (class "pi-item pi-data") (data-source "description"))
- (h3 (@ (class "pi-data-label"))
- "Description")
- (div (@ (class "pi-data-value"))
- "Mystery infobox!")))
- (div (@ (data-test-collapsesection) (class "collapsible collapsetoggle-inline collapsed"))
- (i (b "This section is hidden for dramatic effect."))
- (div (@ (class "collapsible-content"))
- (p "Another page link: "
- (a (@ (data-test-wikilink) (href "https://test.fandom.com/wiki/Another_Page") (title "Another Page"))
- "Another Page"))))
- (figure (@ (class "thumb tnone"))
- (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")
- (data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
- (class "thumbimage lazyload"))))
- (noscript
- (a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image"))
- (img (@ (src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
- (data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
- (class "thumbimage")))))
- (figcaption "Test figure!"))
- (iframe (@ (src "https://example.com/iframe-src")))
- (div (@ (class "reviews"))
- (header "GameSpot Expert Reviews"))
- (div (@ (data-test-ampersand) (class "mw-collapsible-content"))
- (& ndash))))))
-
-(define (updater wikiname #:strict-proxy? [strict-proxy? #f])
- ;; precompute wikiurl regex for efficency
- (define wikiurl-regex (pregexp (format "^https://(~a)\\.fandom\\.com(/wiki/.*)$" px-wikiname)))
- ;; precompute link replacement string for efficiency
- (define wiki-substitution (format "/~a\\1" wikiname))
-
- (define classlist-updater
- (compose1
- ; uncollapse all navbox items (bottom of page mass navigation)
- (curry u
- (λ (classlist) (and ; removed due to scoping, would improve peformance (eq? element-type 'table)
- (member "navbox" classlist)
- (member "collapsed" classlist)))
- (λ (classlist) (filter (curry (negate equal?) "collapsed") classlist)))
- ; uncollapse portable-infobox sections
- (curry u
- (λ (classlist) (and ; removed due to scoping, would improve performance (eq? element-type 'section)
- (member "pi-collapse" classlist)))
- (λ (classlist) (filter (λ (v)
- (and (not (equal? v "pi-collapse-closed"))
- (not (equal? v "pi-collapse"))))
- classlist)))
- ; generic: includes article sections and tables, probably more
- (curry u
- (λ (classlist) (and (member "collapsible" classlist)
- (member "collapsed" classlist)))
- (λ (classlist) (filter (curry (negate equal?) "collapsed") classlist)))))
-
- (define ((string-replace-curried from to) str)
- (string-replace str from to))
-
- (define class-updater
- (compose1
- (string-replace-curried " collapsed" "")
- (string-replace-curried "pi-collapse-closed" "")
- (string-replace-curried "pi-collapse" "")))
-
- (define (cardimage-class-updater c)
- (string-append c " bw-updated-cardtable-cardimage"))
-
- (define attributes-updater
- (compose1
- ; uncollapsing
- #;(curry attribute-maybe-update 'class
- (λ (class) (string-join (classlist-updater (string-split class " ")) " ")))
- (curry attribute-maybe-update 'class class-updater)
- ; audio buttons - sample: hearthstone/wiki/Diablo_(Duels_hero)#Sounds
- (curry u
- (λ (v) (has-class? "ext-audiobutton" v))
- (λ (v) (dict-set (dict-remove v 'hidden) 'controls '(""))))
- ; yet more uncollapsing - sample: warframe/wiki/Amp_(Ability)
- (curry u
- (λ (v) (and (dict-has-key? v 'id)
- (string-prefix? (car (dict-ref v 'id)) "mw-customcollapsible")))
- (λ (v) (dict-set v 'style "display:block")))
- ; change links to stay on the same wiki
- (curry attribute-maybe-update 'href
- (λ (href)
- ((compose1
- (λ (href) (regexp-replace #rx"^(/wiki/.*)$" href wiki-substitution))
- (λ (href) (regexp-replace wikiurl-regex href "/\\1\\2")))
- href)))
- ; add noreferrer to a.image
- (curry u
- (λ (v) (and #;(eq? element-type 'a)
- (has-class? "image" v)))
- (λ (v) (dict-update v 'rel (λ (s)
- (list (string-append (car s) " noreferrer")))
- '(""))))
- ; proxy images from inline styles, if strict_proxy is set
- (curry u
- (λ (v) strict-proxy?)
- (λ (v) (attribute-maybe-update
- 'style
- (λ (style)
- (regexp-replace #rx"url\\(['\"]?(.*?)['\"]?\\)" style
- (λ (whole url)
- (string-append
- "url("
- (u-proxy-url url)
- ")")))) v)))
- ; and also their links, if strict_proxy is set
- (curry u
- (λ (v)
- (and strict-proxy?
- #;(eq? element-type 'a)
- (or (has-class? "image-thumbnail" v)
- (has-class? "image" v))))
- (λ (v) (attribute-maybe-update 'href u-proxy-url v)))
- ; proxy images from src attributes, if strict_proxy is set
- (curry u
- (λ (v) strict-proxy?)
- (λ (v) (attribute-maybe-update 'src u-proxy-url v)))
- ; don't lazyload images
- (curry u
- (λ (v) (dict-has-key? v 'data-src))
- (λ (v) (attribute-maybe-update 'src (λ (_) (car (dict-ref v 'data-src))) v)))
- ; don't use srcset - TODO: use srcset?
- (λ (v) (dict-remove v 'srcset))))
-
- (define (children-updater attributes children)
- ; more uncollapsing - sample: bandori/wiki/BanG_Dream!_Wikia
- ((λ (children)
- (u
- (λ (v) (has-class? "mw-collapsible-content" attributes))
- (λ (v) (for/list ([element v])
- (u (λ (element) (element-is-element? element))
- (λ (element)
- `(,(car element)
- (@ ,@(attribute-maybe-update 'style (λ (a) (regexp-replace #rx"display: *none" a "display:inline")) (bits->attributes element)))
- ,@(filter element-is-content? (cdr element))))
- element)))
- children))
- ; wrap blinking animated images in a slot so they can be animated with CSS
- ((λ (children)
- (u
- (λ (v) (and (has-class? "animated" attributes)
- ((length v) . > . 1)))
- (λ (v)
- `((span (@ (class "animated-slot__outer") (style ,(format "--steps: ~a" (length v))))
- (span (@ (class "animated-slot__inner"))
- ,@v))))
- children))
- children)))
-
- (define (updater element element-type attributes children)
- ;; replace whole element?
- (cond
- ; wrap tables in a div.table-scroller
- [(and (eq? element-type 'table)
- (has-class? "wikitable" attributes)
- (not (dict-has-key? attributes 'data-scrolling)))
- `(div
- ((class "table-scroller"))
- ((,element-type (@ (data-scrolling) ,@attributes)
- ,@children)))]
- ; HACK for /yugioh/wiki/Pot_of_Greed: move card images above tables
- [(and (eq? element-type 'table)
- (has-class? "cardtable" attributes)
- (not (has-class? "bw-updated-cardtable-cardimage" attributes)))
- (define (is-cardimage? t a c) (and (eq? t 'td)
- (has-class? "cardtable-cardimage" a)))
- (define cardimage ((query-selector is-cardimage? element)))
- (if (not cardimage)
- (list element-type attributes children)
- (let ([new-cardtable (update-tree
- (λ (e t a c)
- (if (is-cardimage? t a c)
- return-no-element
- (list t a c)))
- `(,element-type
- (@ ,(attribute-maybe-update 'class cardimage-class-updater attributes))
- ,@children))])
- (list 'div null (list cardimage new-cardtable))))]
- ; exclude empty figcaptions
- [(and (eq? element-type 'figcaption)
- (or (eq? (length (filter element-is-element? children)) 0)
- ((query-selector (λ (element-type attributes children)
- (eq? element-type 'use))
- element))))
- return-no-element]
- ; exclude infobox items that are videos, and gallery items that are videos
- [(and (or (has-class? "pi-item" attributes)
- (has-class? "wikia-gallery-item" attributes))
- ((query-selector (λ (element-type attributes children)
- (has-class? "video-thumbnail" attributes))
- element)))
- return-no-element]
- ; exclude the invisible brackets after headings
- [(and (eq? element-type 'span)
- (has-class? "mw-editsection" attributes))
- return-no-element]
- ; display a link instead of an iframe
- [(eq? element-type 'iframe)
- (define src (car (dict-ref attributes 'src null)))
- `(a
- ((class "iframe-alternative") (href ,src))
- (,(format "Embedded media: ~a" src)))]
- ; remove noscript versions of images because they are likely lower quality than the script versions
- [(and (eq? element-type 'noscript)
- (match children
- ; either the noscript has a.image as a first child...
- [(list (list 'a (list '@ a-att ...) _)) (has-class? "image" a-att)]
- ; or the noscript has img as a first child
- [(list (list 'img _)) #t]
- [_ #f]))
- return-no-element]
- ; remove gamespot reviews/ads
- [(has-class? "reviews" attributes)
- return-no-element]
- ; remove customcollapsible customtoggle buttons - sample: warframe/wiki/Amp_(Ability)
- [(and (dict-has-key? attributes 'class) (regexp-match? #rx"^mw-customtoggle-[^ ]* button-c$" (car (dict-ref attributes 'class))))
- return-no-element]
- [#t
- (list element-type
- ;; attributes
- (attributes-updater #; element-type attributes)
- ;; children
- (children-updater attributes children))]))
-
- updater)
-
-(define (update-tree-wiki tree wikiname #:strict-proxy? [strict-proxy? #f])
- (update-tree (updater wikiname #:strict-proxy? strict-proxy?) tree))
-
-(module+ test
- (define transformed
- (update-tree-wiki wiki-document "test" #:strict-proxy? #t))
- ; check that wikilinks are changed to be local
- (check-equal? (get-attribute 'href (bits->attributes
- ((query-selector
- (λ (t a c) (dict-has-key? a 'data-test-wikilink))
- transformed))))
- "/test/wiki/Another_Page")
- ; check that a.image has noreferrer
- (check-equal? (get-attribute 'rel (bits->attributes
- ((query-selector
- (λ (t a c) (and (eq? t 'a)
- (has-class? "image" a)))
- transformed))))
- " noreferrer")
- ; check that article collapse sections become uncollapsed
- (check-equal? (get-attribute 'class (bits->attributes
- ((query-selector
- (λ (t a c) (dict-has-key? a 'data-test-collapsesection))
- transformed))))
- "collapsible collapsetoggle-inline")
- ; check that iframes are gone
- (check-false ((query-selector (λ (t a c) (eq? t 'iframe)) transformed)))
- (check-equal? (let* ([alternative ((query-selector (λ (t a c) (has-class? "iframe-alternative" a)) transformed))]
- [link ((query-selector (λ (t a c) (eq? t 'a)) alternative))])
- (get-attribute 'href (bits->attributes link)))
- "https://example.com/iframe-src")
- ; check that images are proxied
- (check-equal? (get-attribute 'src (bits->attributes
- ((query-selector
- (λ (t a c) (eq? t 'img))
- transformed))))
- "/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image-thumbnail.png")
- ; check that links to images are proxied
- (check-equal? (get-attribute 'href (bits->attributes
- ((query-selector
- (λ (t a c) (and (eq? t 'a) (has-class? "image-thumbnail" a)))
- transformed))))
- "/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-equal? ((query-selector (λ (t a c) (eq? t 'noscript)) transformed)) #f)
- ; check that gamespot reviews/ads are removed
- (check-equal? ((query-selector (λ (t a c) (has-class? "reviews" a)) transformed)) #f)
- ; check that (& x) sequences are not broken
- (check-equal? ((query-selector (λ (t a c) (dict-has-key? a 'data-test-ampersand)) transformed))
- '(div (@ (data-test-ampersand) (class "mw-collapsible-content"))
- (& ndash)))
- ; benchmark
- (when (file-exists? "../storage/Frog.html")
- (with-input-from-file "../storage/Frog.html"
- (λ ()
- (define tree (html->xexp (current-input-port)))
- (time (length (update-tree-wiki tree "minecraft")))))))
diff --git a/misc/download-wiki-names.rkt b/misc/download-wiki-names.rkt
index 14e281f..96a8f9a 100644
--- a/misc/download-wiki-names.rkt
+++ b/misc/download-wiki-names.rkt
@@ -4,7 +4,7 @@
racket/string
json
net/http-easy
- "../lib/html-parsing/main.rkt"
+ html-parsing
"../src/xexpr-utils.rkt"
"../src/url-utils.rkt")
diff --git a/req.rktd b/req.rktd
deleted file mode 100644
index e2d2fc2..0000000
--- a/req.rktd
+++ /dev/null
@@ -1 +0,0 @@
-((local (".")))
diff --git a/src/application-globals.rkt b/src/application-globals.rkt
index 26cd6ae..a0ff8af 100644
--- a/src/application-globals.rkt
+++ b/src/application-globals.rkt
@@ -1,27 +1,23 @@
#lang racket/base
-(require racket/file
- racket/list
- racket/runtime-path
+(require racket/list
racket/string
json
(prefix-in easy: net/http-easy)
- html-parsing
html-writing
web-server/http
- web-server/http/bindings
"config.rkt"
"data.rkt"
- "extwiki-data.rkt"
- "extwiki-generic.rkt"
+ "niwa-data.rkt"
"static-data.rkt"
- "../lib/syntax.rkt"
- "../lib/pure-utils.rkt"
- "../lib/xexpr-utils.rkt"
- "../lib/url-utils.rkt")
+ "pure-utils.rkt"
+ "xexpr-utils.rkt"
+ "url-utils.rkt")
(provide
; headers to always send on all http responses
always-headers
+ ; timeout durations for http-easy requests
+ timeouts
; generates a consistent footer
application-footer
; generates a consistent template for wiki page content to sit in
@@ -31,18 +27,12 @@
(module+ test
(require rackunit
- html-writing
- "test-utils.rkt"))
+ html-writing))
(define always-headers
(list (header #"Referrer-Policy" #"same-origin") ; header to not send referers to fandom
(header #"Link" (string->bytes/latin-1 link-header))))
-
-(define-runtime-path path-static "../static")
-(define theme-icons
- (for/hasheq ([theme '(default light dark)])
- (values theme
- (html->xexp (file->string (build-path path-static (format "icon-theme-~a.svg" theme)) #:mode 'binary)))))
+(define timeouts (easy:make-timeout-config #:lease 5 #:connect 5))
(define (application-footer source-url #:license [license-in #f])
(define license (or license-in license-default))
@@ -58,130 +48,75 @@
"Documentation and more information"))
(p
(a (@ (href "https://lists.sr.ht/~cadence/breezewiki-discuss"))
- "Chat / Bug reports / Feature requests"))
- ,(if (config-member? 'promotions::indie_wiki_buddy "footer")
- `(p
- (a (@ (href "https://getindie.wiki/"))
- "Get Indie Wiki Buddy browser extension - be redirected to BreezeWiki every time!"))
- "")
+ "Discussions / Bug reports / Feature requests"))
,(if (config-true? 'instance_is_official)
`(p ,(format "This instance is run by the ~a developer, " (config-get 'application_name))
(a (@ (href "https://cadence.moe/contact"))
- "Cadence")
- ".")
+ "Cadence."))
`(p
,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application_name)))))
,(if source-url
`(div (p "This page displays proxied content from "
- (a (@ (href ,source-url) (rel "nofollow noreferrer")) ,source-url)
+ (a (@ (href ,source-url) (rel "noreferrer")) ,source-url)
,(format ". Text content is available under the ~a license, " (license^-text license))
- (a (@ (href ,(license^-url license)) (rel "nofollow")) "see license info.")
+ (a (@ (href ,(license^-url license))) "see license info.")
" Media files may have different copying restrictions.")
(p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application_name))))
`(div (p "Text content on wikis run by Fandom is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported), "
- (a (@ (href "https://www.fandom.com/licensing") (rel "nofollow")) "see license info.")
+ (a (@ (href "https://www.fandom.com/licensing")) "see license info.")
" Media files and official Fandom documents have different copying restrictions.")
(p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application_name))))))))
;; 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
-(define (extwiki-notice wikiname title req user-cookies)
- (define xt (findf (λ (item) (member wikiname (extwiki^-wikinames item))) extwikis))
- (cond/var
- [xt
- (let* ([seen? (member wikiname (user-cookies^-notices user-cookies))]
- [aside-class (if seen? "niwa__notice niwa--seen" "niwa__notice")]
- [group (hash-ref extwiki-groups (extwiki^-group xt))]
- [search-page (format "/Special:Search?~a"
- (params->query `(("search" . ,title)
- ("go" . "Go"))))]
- [go (if (string-suffix? (extwiki^-home xt) "/")
- (regexp-replace #rx"/$" (extwiki^-home xt) (λ (_) search-page))
- (let* ([joiner (second (regexp-match #rx"/(w[^./]*)/" (extwiki^-home xt)))])
- (regexp-replace #rx"/w[^./]*/.*$" (extwiki^-home xt) (λ (_) (format "/~a~a" joiner search-page)))))]
- [props (extwiki-props^ go)])
- (cond
- [(eq? (extwiki^-banner xt) 'default)
- `(aside (@ (class ,aside-class))
- (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) " →")
- (div (@ (class "niwa__cols"))
- (div (@ (class "niwa__left"))
- (p ,((extwiki^-description xt) props))
- (p ,((extwiki-group^-description group) props))
- (p "This wiki's core community has largely migrated away from Fandom. You should "
- (a (@ (href ,go)) "go to " ,(extwiki^-name xt) " now!"))
- (p (@ (class "niwa__feedback"))
- ,@(add-between
- `(,@(for/list ([link (extwiki-group^-links group)])
- `(a (@ (href ,(cdr link))) ,(car link)))
- "This notice is from BreezeWiki"
- (a (@ (rel "nofollow")
- (class "niwa__got-it")
- (href ,(user-cookies-setter-url/add-notice req user-cookies wikiname)))
- "OK, got it"))
- " / ")))
- (div (@ (class "niwa__right"))
- (img (@ (class "niwa__logo") (src ,(extwiki^-logo xt)))))))]
- [(eq? (extwiki^-banner xt) 'parallel)
- `(aside (@ (class "niwa__parallel"))
- (h1 (@ (class "niwa__header-mini"))
- "See also "
- (a (@ (href ,go)) ,(extwiki^-name xt)))
- (p "This topic has multiple communities of editors, some active on the Fandom wiki, others active on " ,(extwiki^-name xt) ".")
- (p "For thorough research, be sure to check both communities since they may have different information!")
- (p (@ (class "niwa__feedback"))
- ,@(add-between
- `(,@(for/list ([link (extwiki-group^-links group)])
- `(a (@ (href ,(cdr link))) ,(car link)))
- "This notice is from BreezeWiki"
- (a (@ (href "https://docs.breezewiki.com/Reporting_Bugs.html")) "Feedback?"))
- " / ")))]
- [(eq? (extwiki^-banner xt) 'empty)
- `(aside (@ (class "niwa__notice niwa__notice--alt"))
- (h1 (@ (class "niwa__header")) "You will be redirected to " ,(extwiki^-name xt) ".")
- (p (@ (style "position: relative; top: -12px;")) "This independent wiki community has its own site separate from Fandom.")
- (a (@ (class "niwa__go") (href ,go)) "Take me there! →")
-
- (p (@ (class "niwa__feedback") (style "text-align: left"))
- ,@(add-between
- `(,@(for/list ([link (extwiki-group^-links group)])
- `(a (@ (href ,(cdr link))) ,(car link)))
- "This notice is from BreezeWiki")
- " / ")))]))]
- (var fetched-callback (get-redirect-content wikiname))
- [fetched-callback
- (fetched-callback title)]
- [#t ""]))
+(define (niwa-notice wikiname title)
+ (define ind (findf (λ (item) (member wikiname (first item))) niwa-data))
+ (if ind
+ (let* ([search-page (format "/Special:Search?~a"
+ (params->query `(("search" . ,title)
+ ("go" . "Go"))))]
+ [go (if (string-suffix? (third ind) "/")
+ (regexp-replace #rx"/$" (third ind) (λ (_) search-page))
+ (let* ([joiner (second (regexp-match #rx"/(w[^./]*)/" (third ind)))])
+ (regexp-replace #rx"/w[^./]*/.*$" (third ind) (λ (_) (format "/~a~a" joiner search-page)))))])
+ `(aside (@ (class "niwa__notice"))
+ (h1 (@ (class "niwa__header")) ,(second ind) " has its own website separate from Fandom.")
+ (a (@ (class "niwa__go") (href ,go)) "Read " ,title " on " ,(second ind) " →")
+ (div (@ (class "niwa__cols"))
+ (div (@ (class "niwa__left"))
+ (p "Most major Nintendo wikis are part of the "
+ (a (@ (href "https://www.niwanetwork.org/about/")) "Nintendo Independent Wiki Alliance")
+ " and have their own wikis off Fandom. You can help this wiki by "
+ (a (@ (href ,go)) "visiting it directly."))
+ (p ,(fifth ind))
+ (div (@ (class "niwa__divider")))
+ (p "Why are you seeing this message? Fandom refuses to delete or archive their copy of this wiki, so that means their pages will appear high up in search results. Fandom hopes to get clicks from readers who don't know any better.")
+ (p (@ (class "niwa__feedback")) (a (@ (href "https://www.kotaku.com.au/2022/10/massive-zelda-wiki-reclaims-independence-six-months-before-tears-of-the-kingdom/")) "More info") " / " (a (@ (href "https://docs.breezewiki.com/Reporting_Bugs.html")) "Feedback on this notice?")))
+ (div (@ (class "niwa__right"))
+ (img (@ (class "niwa__logo") (src ,(format "https://www.niwanetwork.org~a" (fourth ind)))))))))
+ ""))
(define (generate-wiki-page
content
- #:req req
#:source-url source-url
#:wikiname wikiname
#:title title
#:head-data [head-data-in #f]
- #:siteinfo [siteinfo-in #f]
- #:user-cookies [user-cookies-in #f]
- #:online-styles [online-styles #t])
+ #:siteinfo [siteinfo-in #f])
(define siteinfo (or siteinfo-in siteinfo-default))
(define head-data (or head-data-in ((head-data-getter wikiname))))
- (define user-cookies (or user-cookies-in (user-cookies-getter req)))
- (define origin (format "https://~a.fandom.com" wikiname))
- (define required-styles
- (cond
- [online-styles
- (define styles
- (list
- (format "~a/wikia.php?controller=ThemeApi&method=themeVariables&variant=~a" origin (user-cookies^-theme user-cookies))
- (format "~a/load.php?lang=en&modules=site.styles%7Cskin.fandomdesktop.styles%7Cext.fandom.PortableInfoboxFandomDesktop.css%7Cext.fandom.GlobalComponents.CommunityHeaderBackground.css%7Cext.fandom.photoGallery.gallery.css%7Cext.gadget.site-styles%2Csound-styles&only=styles&skin=fandomdesktop" origin)))
- (if (config-true? 'strict_proxy)
- (map u-proxy-url styles)
- styles)]
- [#t
- (list
- (format "/archive/~a/styles/themeVariables-~a.css" wikiname (user-cookies^-theme user-cookies))
- (format "/archive/~a/styles/site.css" wikiname))]))
+ (define (required-styles origin)
+ (map (λ (dest-path)
+ (define url (format dest-path origin))
+ (if (config-true? 'strict_proxy)
+ (u-proxy-url url)
+ url))
+ '(#;"~a/load.php?lang=en&modules=skin.fandomdesktop.styles&only=styles&skin=fandomdesktop"
+ #;"~a/load.php?lang=en&modules=ext.gadget.dungeonsWiki%2CearthWiki%2Csite-styles%2Csound-styles&only=styles&skin=fandomdesktop"
+ #;"~a/load.php?lang=en&modules=site.styles&only=styles&skin=fandomdesktop"
+ ; combine the above entries into a single request for potentially extra speed - fandom.com doesn't even do this!
+ "~a/wikia.php?controller=ThemeApi&method=themeVariables"
+ "~a/load.php?lang=en&modules=skin.fandomdesktop.styles%7Cext.fandom.PortableInfoboxFandomDesktop.css%7Cext.fandom.GlobalComponents.CommunityHeaderBackground.css%7Cext.gadget.site-styles%2Csound-styles%7Csite.styles&only=styles&skin=fandomdesktop")))
`(*TOP*
(*DECL* DOCTYPE html)
(html
@@ -193,7 +128,7 @@
(config-get 'application_name)))
,@(map (λ (url)
`(link (@ (rel "stylesheet") (type "text/css") (href ,url))))
- required-styles)
+ (required-styles (format "https://~a.fandom.com" wikiname)))
(link (@ (rel "stylesheet") (type "text/css") (href ,(get-static-url "main.css"))))
(script "const BWData = "
,(jsexpr->string (hasheq 'wikiname wikiname
@@ -201,33 +136,15 @@
,(if (config-true? 'feature_search_suggestions)
`(script (@ (type "module") (src ,(get-static-url "search-suggestions.js"))))
"")
- (script (@ (type "module") (src ,(get-static-url "countdown.js"))))
- (script (@ (defer) (src ,(get-static-url "tabs.js"))))
(link (@ (rel "icon") (href ,(u (λ (v) (config-true? 'strict_proxy))
(λ (v) (u-proxy-url v))
(head-data^-icon-url head-data))))))
- (body (@ (class ,(head-data^-body-class head-data) " bw-tabs-nojs"))
- ,(let ([extension-eligible?
- (cond/var
- [(not req) #f]
- [(not (config-member? 'promotions::indie_wiki_buddy "banner")) #f]
- (var ua-pair (assq 'user-agent (request-headers req)))
- [(not ua-pair) #f]
- (var ua (string-downcase (cdr ua-pair)))
- ;; everyone pretends to be chrome, so we do it in reverse
- ;; this excludes common browsers that don't support the extension
- [#t (and (not (string-contains? ua "edge/"))
- (not (string-contains? ua "mobile")))])])
- (if extension-eligible?
- `(div (@ (class "bw-top-banner"))
- (div (@ (class "bw-top-banner-rainbow"))
- "Try " (a (@ (href "https://getindie.wiki/") (target "_blank")) "our affiliated browser extension") " - redirect to BreezeWiki automatically!\n"))
- ""))
+ (body (@ (class ,(head-data^-body-class head-data)))
(div (@ (class "main-container"))
(div (@ (class "fandom-community-header__background tileHorizontally header")))
(div (@ (class "page"))
(main (@ (class "page__main"))
- ,(extwiki-notice wikiname title req user-cookies)
+ ,(niwa-notice wikiname title)
(div (@ (class "custom-top"))
(h1 (@ (class "page-title")) ,title)
(nav (@ (class "sitesearch"))
@@ -237,23 +154,7 @@
(label (@ (for "bw-search-input")) "Search ")
(div (@ (id "bw-pr-search-input"))
(input (@ (type "text") (name "q") (id "bw-search-input") (autocomplete "off"))))
- (div (@ (class "bw-ss__container") (id "bw-pr-search-suggestions"))))
- (div (@ (class "bw-theme__select"))
- (span (@ (class "bw-theme__main-label")) "Page theme")
- (span (@ (class "bw-theme__items"))
- ,@(for/list ([theme '(default light dark)])
- (define class
- (if (equal? theme (user-cookies^-theme user-cookies))
- "bw-theme__item bw-theme__item--selected"
- "bw-theme__item"))
- `(a (@ (rel "nofollow")
- (href ,(user-cookies-setter-url
- req
- (struct-copy user-cookies^ user-cookies
- [theme theme]))) (class ,class))
- (span (@ (class "bw-theme__icon-container"))
- ,(hash-ref theme-icons theme))
- ,(format "~a" theme)))))))
+ (div (@ (class "bw-ss__container") (id "bw-pr-search-suggestions"))))))
(div (@ (id "content") #;(class "page-content"))
(div (@ (id "mw-content-text"))
,content))
@@ -263,7 +164,6 @@
(parameterize ([(config-parameter 'strict_proxy) "true"])
(generate-wiki-page
'(template)
- #:req test-req
#:source-url ""
#:title "test"
#:wikiname "test")))
@@ -278,11 +178,11 @@
page))))
"/proxy?dest=https%3A%2F%2Ftest.fandom.com")))
-(define (generate-redirect dest #:headers [headers-in '()])
+(define (generate-redirect dest)
(define dest-bytes (string->bytes/utf-8 dest))
(response/output
#:code 302
- #:headers (append (list (header #"Location" dest-bytes)) headers-in)
+ #:headers (list (header #"Location" dest-bytes))
(λ (out)
(write-html
`(html
diff --git a/src/config.rkt b/src/config.rkt
index b1afe0a..bc0cf6c 100644
--- a/src/config.rkt
+++ b/src/config.rkt
@@ -2,17 +2,19 @@
(require racket/function
racket/pretty
racket/runtime-path
- racket/string
- typed/ini)
+ racket/string)
+(require/typed ini
+ [#:opaque Ini ini?]
+ [read-ini (Input-Port -> Ini)]
+ [ini->hash (Ini -> (Immutable-HashTable Symbol (Immutable-HashTable Symbol String)))])
(provide
config-parameter
config-true?
- config-member?
config-get)
(module+ test
- (require "../lib/typed-rackunit.rkt"))
+ (require "typed-rackunit.rkt"))
(define-runtime-path path-config "../config.ini")
@@ -24,87 +26,72 @@
(define (config-true? key)
(not (member ((config-parameter key)) '("" "false"))))
-(: config-member? (Symbol String [#:sep String] -> Boolean))
-(define (config-member? key item #:sep [sep #px"\\s+"])
- (and (config-true? key)
- (not (not (member item (string-split (config-get key) sep))))))
-
(: config-get (Symbol -> String))
(define (config-get key)
((config-parameter key)))
(define default-config
'((application_name . "BreezeWiki")
- (bind_host . "auto")
- (port . "10416")
(canonical_origin . "")
(debug . "false")
(feature_search_suggestions . "true")
(instance_is_official . "false") ; please don't turn this on, or you will make me very upset
(log_outgoing . "true")
- (strict_proxy . "false")
-
- (feature_offline::enabled . "false")
- (feature_offline::format . "json.gz")
- (feature_offline::only . "false")
- (feature_offline::search . "fandom")
-
- (access_log::enabled . "false")
-
- (promotions::indie_wiki_buddy . "banner home")))
+ (port . "10416")
+ (strict_proxy . "true")))
(define loaded-alist
(with-handlers
([exn:fail:filesystem:errno?
(λ (exn)
- (displayln "note: config file not detected, using defaults")
- '())]
+ (begin0
+ '()
+ (displayln "note: config file not detected, using defaults")))]
[exn:fail:contract?
(λ (exn)
- (displayln "note: config file empty or missing [] section, using defaults")
- '())])
- (define h (in-hash
- (ini->hash
- (call-with-input-file path-config
- (λ (in)
- (read-ini in))))))
+ (begin0
+ '()
+ (displayln "note: config file empty or missing [] section, using defaults")))])
(define l
- (for*/list : (Listof (Pairof Symbol String))
- ([(section-key section) h]
- [(key value) (in-hash section)])
- (if (eq? section-key '||)
- (cons key value)
- (cons (string->symbol (string-append (symbol->string section-key)
- "::"
- (symbol->string key)))
- value))))
- (printf "note: ~a items loaded from config file~n" (length l))
- l))
+ (hash->list
+ (hash-ref
+ (ini->hash
+ (call-with-input-file path-config
+ (λ (in)
+ (read-ini in))))
+ '||)))
+ (begin0
+ l
+ (printf "note: ~a items loaded from config file~n" (length l)))))
(define env-alist
- (for/list : (Listof (Pairof Symbol String))
- ([name (environment-variables-names (current-environment-variables))]
- #:when (string-prefix? (string-downcase (bytes->string/latin-1 name)) "bw_"))
- (cons
- ;; key: convert to string, remove bw_ prefix, convert to symbol
- (string->symbol (string-downcase (substring (bytes->string/latin-1 name) 3)))
- ;; value: convert to string
- (bytes->string/latin-1
- (cast (environment-variables-ref (current-environment-variables) name) Bytes)))))
+ (let ([e-names (environment-variables-names (current-environment-variables))]
+ [e-ref (λ ([name : Bytes])
+ (bytes->string/latin-1
+ (cast (environment-variables-ref (current-environment-variables) name)
+ Bytes)))])
+ (map (λ ([name : Bytes])
+ (cons (string->symbol (string-downcase (substring (bytes->string/latin-1 name) 3)))
+ (e-ref name)))
+ (filter (λ ([name : Bytes]) (string-prefix? (string-downcase (bytes->string/latin-1 name))
+ "bw_"))
+ e-names))))
(when (> (length env-alist) 0)
(printf "note: ~a items loaded from environment variables~n" (length env-alist)))
(define combined-alist (append default-config loaded-alist env-alist))
(define config
- (for/hasheq ([pair combined-alist]) : (Immutable-HashTable Symbol (Parameter String))
- (values (car pair) (make-parameter (cdr pair)))))
+ (make-immutable-hasheq
+ (map (λ ([pair : (Pairof Symbol String)])
+ (cons (car pair) (make-parameter (cdr pair))))
+ combined-alist)))
(when (config-true? 'debug)
; all values here are optimised for maximum prettiness
(parameterize ([pretty-print-columns 80])
(display "config: ")
- (pretty-write ((inst sort (Pairof Symbol String) Symbol)
+ (pretty-write ((inst sort (Pairof Symbol String))
(hash->list (make-immutable-hasheq combined-alist))
symbol
#:key car))))
@@ -118,10 +105,6 @@
(module+ test
; this is just a sanity check
(parameterize ([(config-parameter 'application_name) "JeffWiki"]
- [(config-parameter 'strict_proxy) ""]
- [(config-parameter 'promotions::indie_wiki_buddy) "a b c"])
+ [(config-parameter 'strict_proxy) ""])
(check-equal? (config-get 'application_name) "JeffWiki")
- (check-false (config-true? 'strict_proxy))
- (check-equal? (string? (config-get 'feature_offline::format)) #t)
- (check-true (config-member? 'promotions::indie_wiki_buddy "b"))))
-
+ (check-false (config-true? 'strict_proxy))))
diff --git a/src/data.rkt b/src/data.rkt
index 63c7f03..f856710 100644
--- a/src/data.rkt
+++ b/src/data.rkt
@@ -1,76 +1,46 @@
#lang racket/base
(require racket/list
racket/match
- racket/string
- web-server/http/request-structs
- net/url-string
- (only-in net/cookies/server cookie-header->alist cookie->set-cookie-header make-cookie)
(prefix-in easy: net/http-easy)
- db
memo
- "fandom-request.rkt"
"static-data.rkt"
- "../lib/url-utils.rkt"
- "../lib/xexpr-utils.rkt"
- "../archiver/archiver-database.rkt"
- "config.rkt")
+ "url-utils.rkt"
+ "xexpr-utils.rkt")
(provide
(struct-out siteinfo^)
(struct-out license^)
(struct-out head-data^)
- (struct-out user-cookies^)
siteinfo-fetch
siteinfo-default
license-default
head-data-getter
- head-data-default
- user-cookies-getter
- user-cookies-default
- user-cookies-setter
- user-cookies-setter-url
- user-cookies-setter-url/add-notice)
+ head-data-default)
(struct siteinfo^ (sitename basepage license) #:transparent)
(struct license^ (text url) #:transparent)
(struct head-data^ (body-class icon-url) #:transparent)
(define license-default (license^ "CC-BY-SA" "https://www.fandom.com/licensing"))
-(define siteinfo-default (siteinfo^ "Unknown Wiki" "Main_Page" license-default))
+(define siteinfo-default (siteinfo^ "Test Wiki" "Main_Page" license-default))
(define head-data-default (head-data^ "skin-fandomdesktop" (get-static-url "breezewiki-favicon.svg")))
-(when (config-true? 'feature_offline::only)
- (void (get-slc)))
-
(define/memoize (siteinfo-fetch wikiname) #:hash hash
- (cond
- [(config-true? 'feature_offline::only)
- (when (config-true? 'debug)
- (printf "using offline mode for siteinfo ~a~n" wikiname))
- (define row (query-maybe-row* "select sitename, basepage, license_text, license_url from wiki where wikiname = ?"
- wikiname))
- (if row
- (siteinfo^ (vector-ref row 0)
- (vector-ref row 1)
- (license^ (vector-ref row 2)
- (vector-ref row 3)))
- siteinfo-default)]
- [else
- (define res
- (fandom-get-api
- wikiname
- '(("action" . "query")
- ("meta" . "siteinfo")
- ("siprop" . "general|rightsinfo")
- ("format" . "json")
- ("formatversion" . "2"))))
- (cond [(= (easy:response-status-code res) 200)
- (define data (easy:response-json res))
- (siteinfo^ (jp "/query/general/sitename" data)
- (second (regexp-match #rx"/wiki/(.*)" (jp "/query/general/base" data)))
- (license^ (jp "/query/rightsinfo/text" data)
- (jp "/query/rightsinfo/url" data)))]
- [else siteinfo-default])]))
+ (define dest-url
+ (format "https://~a.fandom.com/api.php?~a"
+ wikiname
+ (params->query '(("action" . "query")
+ ("meta" . "siteinfo")
+ ("siprop" . "general|rightsinfo")
+ ("format" . "json")
+ ("formatversion" . "2")))))
+ (log-outgoing dest-url)
+ (define res (easy:get dest-url))
+ (define data (easy:response-json res))
+ (siteinfo^ (jp "/query/general/sitename" data)
+ (second (regexp-match #rx"/wiki/(.*)" (jp "/query/general/base" data)))
+ (license^ (jp "/query/rightsinfo/text" data)
+ (jp "/query/rightsinfo/url" data))))
(define/memoize (head-data-getter wikiname) #:hash hash
;; data will be stored here, can be referenced by the memoized closure
@@ -91,40 +61,3 @@
(set! this-data data))
;; then no matter what, return the best information we have so far
this-data))
-
-(struct user-cookies^ (theme notices) #:prefab)
-(define user-cookies-default (user-cookies^ 'default '()))
-(define (user-cookies-getter 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-hash
- (for/hasheq ([pair cookies-alist])
- (match pair
- [(cons "theme" (and theme (or "light" "dark" "default")))
- (values 'theme (string->symbol theme))]
- [(cons "notices" notices)
- (values 'notices (string-split notices "|"))]
- [_ (values #f #f)])))
- (user-cookies^
- (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)
- (map (λ (c) (header #"Set-Cookie" (cookie->set-cookie-header c)))
- (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 "/"
- #:max-age (* 60 60 24 365 10)))))
-
-(define (user-cookies-setter-url req new-settings)
- (format "/set-user-settings?~a" (params->query `(("next_location" . ,(url->string (request-uri req)))
- ("new_settings" . ,(format "~s" 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))])))
diff --git a/src/dispatcher-tree.rkt b/src/dispatcher-tree.rkt
index a967095..06709a6 100644
--- a/src/dispatcher-tree.rkt
+++ b/src/dispatcher-tree.rkt
@@ -1,17 +1,17 @@
#lang racket/base
-(require "../lib/syntax.rkt"
+(require "syntax.rkt"
(for-syntax racket/base)
racket/string
net/url
- web-server/http
- web-server/dispatchers/dispatch
(prefix-in host: web-server/dispatchers/dispatch-host)
(prefix-in pathprocedure: web-server/dispatchers/dispatch-pathprocedure)
(prefix-in sequencer: web-server/dispatchers/dispatch-sequencer)
(prefix-in lift: web-server/dispatchers/dispatch-lift)
(prefix-in filter: web-server/dispatchers/dispatch-filter)
+ web-server/private/connection-manager
"config.rkt"
- "../lib/url-utils.rkt")
+ "static-data.rkt"
+ "url-utils.rkt")
(provide
; syntax to make the hashmap from names
@@ -33,48 +33,42 @@
; don't forget that I'm returning *code* - return a call to the function
(datum->syntax stx `(make-dispatcher-tree ,ds)))
-; guard that the page returned a response, otherwise print more detailed debugging information
-(define-syntax-rule (page ds name)
- (λ (req)
- (define dispatcher (hash-ref ds (quote name)))
- (define page-response (dispatcher req))
- (if (response? page-response)
- page-response
- (response/output
- #:code 500
- #:mime-type #"text/plain"
- (λ (out)
- (for ([port (list (current-error-port) out)])
- (parameterize ([current-output-port port])
- (printf "error in ~a:~n expected page to return a response~n actually returned: ~v~n"
- (quote name)
- page-response))))))))
+(define (write-bytes* out . bs)
+ (for ([b bs]) (write-bytes b out)))
+
+;; HTTP 103 Early Hints https://datatracker.ietf.org/doc/html/rfc8297
+;; a dispatcher services a request or calls next-dispatcher
+(define ((early-hints:make original-dispatcher) conn req)
+ ;; normally this would call output-response/method to write output based on the method
+ ;; e.g. if it's HEAD then only output the headers
+ (define o (connection-o-port conn))
+ (write-bytes* o
+ #"HTTP/1.1 103 Early Hints\r\n"
+ #"Link: " (string->bytes/latin-1 link-header) #"\r\n"
+ #"\r\n")
+ (flush-output o)
+ ;; after doing early hints, I need to run the original dispatcher to generate the real response.
+ ;; dispatchers do not return anything.
+ (original-dispatcher conn req))
(define (make-dispatcher-tree ds)
- (define subdomain-dispatcher (hash-ref ds 'subdomain-dispatcher))
- (define tree
- (sequencer:make
- subdomain-dispatcher
- (pathprocedure:make "/" (page ds page-home))
- (pathprocedure:make "/proxy" (page ds page-proxy))
- (pathprocedure:make "/search" (page ds page-global-search))
- (pathprocedure:make "/set-user-settings" (page ds page-set-user-settings))
- (pathprocedure:make "/buddyfight/wiki/It_Doesn't_Work!!" (page ds page-it-works))
- (filter:make (pregexp (format "^/~a/wiki/Category:.+$" px-wikiname)) (lift:make (page ds page-category)))
- (filter:make (pregexp (format "^/~a/wiki/File:.+$" px-wikiname)) (lift:make (page ds page-file)))
- (if (config-true? 'feature_offline::enabled)
- (filter:make (pregexp (format "^/~a/wiki/.+$" px-wikiname)) (lift:make (page ds page-wiki-offline)))
- (λ (_conn _req) (next-dispatcher)))
- (filter:make (pregexp (format "^/~a/wiki/.+$" px-wikiname)) (lift:make (page ds page-wiki)))
- (filter:make (pregexp (format "^/~a/search$" px-wikiname)) (lift:make (page ds page-search)))
- (filter:make (pregexp (format "^/~a(/(wiki(/)?)?)?$" px-wikiname)) (lift:make (page ds redirect-wiki-home)))
- (if (config-true? 'feature_offline::enabled)
- (filter:make (pregexp (format "^/archive/~a/(styles|images)/.+$" px-wikiname)) (lift:make (page ds page-static-archive)))
- (λ (_conn _req) (next-dispatcher)))
- (hash-ref ds 'static-dispatcher)
- (lift:make (hash-ref ds 'page-not-found))))
- (make-semicolon-fixer-dispatcher tree))
-
-(define ((make-semicolon-fixer-dispatcher orig-dispatcher) conn orig-req)
- (define new-req (struct-copy request orig-req [uri (fix-semicolons-url (request-uri orig-req))]))
- (orig-dispatcher conn new-req))
+ (host:make
+ (λ (host-sym)
+ (if/out (config-true? 'canonical_origin)
+ (let* ([host-header (symbol->string host-sym)]
+ [splitter (string-append "." (url-host (string->url (config-get 'canonical_origin))))]
+ [s (string-split host-header splitter #:trim? #f)])
+ (if/in (and (eq? 2 (length s)) (equal? "" (cadr s)))
+ ((hash-ref ds 'subdomain-dispatcher) (car s))))
+ (sequencer:make
+ (pathprocedure:make "/" (hash-ref ds 'page-home))
+ (pathprocedure:make "/proxy" (hash-ref ds 'page-proxy))
+ (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/File:.+$" px-wikiname)) (lift:make (hash-ref ds 'page-file)))
+ (filter:make (pregexp (format "^/~a/wiki/.+$" px-wikiname)) (early-hints:make (lift:make (hash-ref ds 'page-wiki))))
+ (filter:make (pregexp (format "^/~a/search$" px-wikiname)) (lift:make (hash-ref ds 'page-search)))
+ (filter:make (pregexp (format "^/~a(/(wiki(/)?)?)?$" px-wikiname)) (lift:make (hash-ref ds 'redirect-wiki-home)))
+ (hash-ref ds 'static-dispatcher)
+ (lift:make (hash-ref ds 'page-not-found)))))))
diff --git a/src/extwiki-data.rkt b/src/extwiki-data.rkt
deleted file mode 100644
index a8ee159..0000000
--- a/src/extwiki-data.rkt
+++ /dev/null
@@ -1,593 +0,0 @@
-#lang racket/base
-
-(provide
- (struct-out extwiki-props^)
- (struct-out extwiki-group^)
- extwiki-groups
- (struct-out extwiki^)
- extwikis)
-
-(struct extwiki-props^ (go) #:transparent)
-
-(struct extwiki-group^ (name links description) #:transparent)
-(define extwiki-groups
- (hasheq 'NIWA
- (extwiki-group^
- "NIWA"
- '(("Why did editors leave Fandom?" . "https://www.kotaku.com.au/2022/10/massive-zelda-wiki-reclaims-independence-six-months-before-tears-of-the-kingdom/"))
- (λ (props)
- `(p "Most major Nintendo wikis are part of the "
- (a (@ (href "https://www.niwanetwork.org/about/")) "Nintendo Independent Wiki Alliance")
- " and have their own wikis off Fandom.")))
-
- 'SEIWA
- (extwiki-group^
- "SEIWA"
- '(("SEIWA Website" . "https://seiwanetwork.org/"))
- (λ (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.")))
-
- '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
- (extwiki-group^
- "Terraria"
- '(("Announcement: New Official Terraria Wiki!" . "https://forums.terraria.org/index.php?threads/new-official-terraria-wiki-launches-today.111239/") ("In the media" . "https://www.pcgamesn.com/terraria/wiki"))
- (λ (props) '()))
-
- 'Calamity_Mod
- (extwiki-group^
- "Calamity Mod"
- '(("Announcement: Moving to wiki.gg" . "https://www.reddit.com/r/CalamityMod/comments/ts0586/important_calamity_wiki_announcement/"))
- (λ (props) '()))
-
- 'ARK
- (extwiki-group^
- "ARK"
- '(("Announcement: Official Wiki Is Moving!" . "https://survivetheark.com/index.php?/forums/topic/657902-official-ark-wiki-feedback/")
- ("Reasons" . "https://todo.sr.ht/~cadence/breezewiki-todo/4#event-216613")
- ("Browser Extension" . "https://old.reddit.com/r/playark/comments/xe51sy/official_ark_wiki_launched_a_browser_extension_to/"))
- (λ (props) '()))
-
- 'Astroneer
- (extwiki-group^
- "Astroneer"
- '(("Migration discussion" . "https://old.reddit.com/r/Astroneer/comments/z905id/the_official_astroneer_wiki_has_moved_to_wikigg/") ("Migration info" . "https://astroneer.fandom.com/wiki/Talk:Astroneer_Wiki/Migration_to_Wiki.gg"))
- (λ (props) '()))
-
- 'RuneScape
- (extwiki-group^
- "RuneScape"
- '(("Leaving Wikia" . "https://runescape.wiki/w/Forum:Leaving_Wikia")
- ("In the media" . "https://kotaku.com/video-game-wikis-abandon-their-platform-after-year-of-p-1829401866")
- ("Browser Extension" . "https://runescape.wiki/w/RuneScape:Finding_the_wikis_with_ease#Extensions"))
- (λ (props) '()))
-
- 'Minecraft
- (extwiki-group^
- "Minecraft"
- '(("Post-Move FAQ" . "https://minecraft.wiki/w/Minecraft_Wiki:Moving_from_Fandom")
- ("Pre-Move Discussion" . "https://minecraft.fandom.com/wiki/Minecraft_Wiki:Moving_from_Fandom")
- ("In the media: PCGamer" . "https://www.pcgamer.com/official-minecraft-wiki-editors-so-furious-at-fandoms-degraded-functionality-and-popups-theyre-overwhelmingly-voting-to-leave-the-site/")
- ("In the media: PCGamesN" . "https://www.pcgamesn.com/minecraft/wiki-fandom"))
- (λ (props)
- '(p "The wiki was founded by Citricsquid on July 16th, 2009 as a way to document information from Minecraft. Since November 15th, 2010, it has been hosted by Curse Media. On December 12th, 2018, it moved to Fandom as it purchased Curse Media. Since September 24, 2023, it forked from Fandom and has been hosted by Weird Gloop.")))
-
- 'Tardis
- (extwiki-group^
- "Tardis"
- '(("Forking announcement" . "https://tardis.wiki/wiki/Tardis:Forking_announcement")
- ("Discussion on Reddit" . "https://old.reddit.com/r/doctorwho/comments/1azxmrl/tardis_wiki_has_regenerated/"))
- (λ (props) '()))
-
- 'Rainverse
- (extwiki-group^
- "Rainverse"
- '(("Forking announcement" . "https://transfem.social/notes/9qsqdkmqi78e01bh"))
- (λ (props)
- '()))
-
- 'empty
- (extwiki-group^
- "Misc"
- '(("This wiki doesn't have a description yet. Add one?" . "https://docs.breezewiki.com/Reporting_Bugs.html"))
- (λ (props) '()))))
-
-;; wikiname, niwa-name, url, logo-url
-(struct extwiki^ (wikinames banner group name home logo description) #:transparent)
-(define extwikis
- (list
- (extwiki^
- '("arms" "armsgame") 'default
- 'NIWA
- "ARMS Institute"
- "https://armswiki.org/wiki/Home"
- "https://niwanetwork.org/images/logos/armswiki.png"
- (λ (props)
- `((p "ARMS Institute is a comprehensive resource for information about the Nintendo Switch game, ARMS. Founded on May 1, 2017 and growing rapidly, the wiki strives to offer in-depth coverage of ARMS from both a competitive and casual perspective. Join us and ARM yourself with knowledge!"))))
-
- (extwiki^
- '("pokemon" "monster") 'default
- 'NIWA
- "Bulbapedia"
- "https://bulbapedia.bulbagarden.net/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/bulbapedia.png"
- (λ (props)
- `((p "A part of the Bulbagarden community, Bulbapedia was founded on December 21, 2004 by Liam Pomfret. Everything you need to know about Pokémon can be found at Bulbapedia, whether about the games, the anime, the manga, or something else entirely. With its Bulbanews section and the Bulbagarden forums, it's your one-stop online place for Pokémon."))))
-
- (extwiki^
- '("dragalialost") 'default
- 'NIWA
- "Dragalia Lost Wiki"
- "https://dragalialost.wiki/w/Dragalia_Lost_Wiki"
- "https://niwanetwork.org/images/logos/dragalialost.png"
- (λ (props)
- `((p "The Dragalia Lost Wiki was originally founded in September 2018 on the Gamepedia platform but went independent in January 2021. The Wiki aims to document anything and everything Dragalia Lost, from in-game data to mechanics, story, guides, and more!"))))
-
- (extwiki^
- '("dragonquest") 'default
- 'NIWA
- "Dragon Quest Wiki"
- "https://dragon-quest.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/dragonquestwiki.png"
- (λ (props)
- `((p "Originally founded on Wikia, the Dragon Quest Wiki was largely inactive until FlyingRagnar became an admin in late 2009. The wiki went independent about a year later when it merged with the Dragon Quest Dictionary/Encyclopedia which was run by Zenithian and supported by the Dragon's Den. The Dragon Quest Wiki aims to be the most complete resource for Dragon Quest information on the web. It continues to grow in the hope that one day the series will be as popular in the rest of the world as it is in Japan."))))
-
- (extwiki^
- '("fireemblem") 'default
- 'NIWA
- "Fire Emblem Wiki"
- "https://fireemblemwiki.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/fireemblemwiki.png"
- (λ (props)
- `((p "Growing since August 26, 2010, Fire Emblem Wiki is a project whose goal is to cover all information pertaining to the Fire Emblem series. It aspires to become the most complete and accurate independent source of information on this series."))))
-
- (extwiki^
- '("fzero" "f-zero") 'default
- 'NIWA
- "F-Zero Wiki"
- "https://mutecity.org/wiki/F-Zero_Wiki"
- "https://niwanetwork.org/images/logos/fzerowiki.png"
- (λ (props)
- `((p "Founded on Wikia in November 2007, F-Zero Wiki became independent with NIWA's help in 2011. F-Zero Wiki is quickly growing into the Internet's definitive source for the world of 2200 km/h+, from pilots to machines, and is the founding part of MuteCity.org, the web's first major F-Zero community."))))
-
- (extwiki^
- '("goldensun") 'default
- 'NIWA
- "Golden Sun Universe"
- "https://www.goldensunwiki.net/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/goldensununiverse.png"
- (λ (props)
- `((p "Originally founded on Wikia in late 2006, Golden Sun Universe has always worked hard to meet one particular goal: to be the single most comprehensive yet accessible resource on the Internet for Nintendo's RPG series Golden Sun. It became an independent wiki four years later. Covering characters and plot, documenting all aspects of the gameplay, featuring walkthroughs both thorough and bare-bones, and packed with all manner of odd and fascinating minutiae, Golden Sun Universe leaves no stone unturned!"))))
-
- (extwiki^
- '("tetris") 'default
- 'NIWA
- "Hard Drop - Tetris Wiki"
- "https://harddrop.com/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/harddrop.png"
- (λ (props)
- `((p "The Tetris Wiki was founded by Tetris fans for Tetris fans on tetrisconcept.com in March 2006. The Tetris Wiki torch was passed to harddrop.com in July 2009. Hard Drop is a Tetris community for all Tetris players, regardless of skill or what version of Tetris you play."))))
-
- (extwiki^
- '("kidicarus") 'default
- 'NIWA
- "Icaruspedia"
- "https://www.kidicaruswiki.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/icaruspedia.png"
- (λ (props)
- `((p "Icaruspedia is the Kid Icarus wiki that keeps flying to new heights. After going independent on January 8, 2012, Icaruspedia has worked to become the largest and most trusted independent source of Kid Icarus information. Just like Pit, they'll keep on fighting until the job is done."))))
-
- (extwiki^
- '("splatoon" "uk-splatoon" "splatoon3" "splatoon2") 'default
- 'NIWA
- "Inkipedia"
- "https://splatoonwiki.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/inkipedia.png"
- (λ (props)
- `((p "Inkipedia is your ever-growing go-to source for all things Splatoon related. Though founded on Wikia on June 10, 2014, Inkipedia went independent on May 18, 2015, just days before Splatoon's release. Our aim is to cover all aspects of the series, both high and low. Come splat with us now!"))))
-
- (extwiki^
- '("starfox") 'default
- 'NIWA
- "Lylat Wiki"
- "https://starfoxwiki.info/wiki/Lylat_Wiki"
- "https://niwanetwork.org/images/logos/lylatwiki.png"
- (λ (props)
- `((p "Out of seemingly nowhere, Lylat Wiki sprung up one day in early 2010. Led by creator, Justin Folvarcik, and project head, Tacopill, the wiki has reached stability since the move to its own domain. The staff of Lylat Wiki are glad to help out the NIWA wikis and are even prouder to join NIWA's ranks as the source for information on the Star Fox series."))))
-
- (extwiki^
- '("metroid" "themetroid") 'default
- 'NIWA
- "Metroid Wiki"
- "https://www.metroidwiki.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/metroidwiki.png"
- (λ (props)
- `((p "Metroid Wiki, founded on January 27, 2010 by Nathanial Rumphol-Janc and Zelda Informer, is a rapidly expanding wiki that covers everything Metroid, from the games, to every suit, vehicle and weapon."))))
-
- (extwiki^
- '("nintendo" "nintendoseries" "nintendogames") 'default
- 'NIWA
- "Nintendo Wiki"
- "http://niwanetwork.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/nintendowiki.png"
- (λ (props)
- `((p "Created on May 12, 2010, NintendoWiki (N-Wiki) is a collaborative project by the NIWA team to create an encyclopedia dedicated to Nintendo, being the company around which all other NIWA content is focused. It ranges from mainstream information such as the games and people who work for the company, to the most obscure info like patents and interesting trivia."))))
-
- (extwiki^
- '("animalcrossing" "animalcrossingcf" "acnh") 'default
- 'NIWA
- "Nookipedia"
- "https://nookipedia.com/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/nookipedia.png"
- (λ (props)
- `((p "Founded in August 2005 on Wikia, Nookipedia was originally known as Animal Crossing City. Shortly after its five-year anniversary, Animal Crossing City decided to merge with the independent Animal Crossing Wiki, which in January 2011 was renamed to Nookipedia. Covering everything from the series including characters, items, critters, and much more, Nookipedia is your number one resource for everything Animal Crossing!"))))
-
- (extwiki^
- '("pikmin") 'default
- 'NIWA
- "Pikipedia"
- "https://www.pikminwiki.com/"
- "https://niwanetwork.org/images/logos/pikipedia.png"
- (λ (props)
- `((p "Pikipedia, also known as Pikmin Wiki, was founded by Dark Lord Revan on Wikia in December 2005. In September 2010, with NIWA's help, Pikipedia moved away from Wikia to become independent. Pikipedia is working towards their goal of being the foremost source for everything Pikmin."))))
-
- (extwiki^
- '("pikmin-fan" "pikpikpedia") 'default
- 'NIWA
- "Pimkin Fanon"
- "https://www.pikminfanon.com/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/pikifanon.png"
- (λ (props)
- `((p "Pikmin Fanon is a Pikmin wiki for fan stories (fanon). Founded back on November 1, 2008 by Rocky0718 as a part of Wikia, Pikmin Fanon has been independent since September 14, 2010. Check them out for fan created stories based around the Pikmin series."))))
-
- (extwiki^
- '("supersmashbros") 'default
- 'NIWA
- "SmashWiki"
- "https://www.ssbwiki.com/"
- "https://niwanetwork.org/images/logos/smashwiki.png"
- (λ (props)
- `((p "Originally two separate wikis (one on SmashBoards, the other on Wikia), SmashWiki as we know it was formed out of a merge on February 29th, 2008, becoming independent on September 28th, 2010. SmashWiki is the premier source of Smash Bros. information, from simple tidbits to detailed mechanics, and also touches on the origins of its wealth of content from its sibling franchises."))))
-
- (extwiki^
- '("starfy") 'default
- 'NIWA
- "Starfy Wiki"
- "https://www.starfywiki.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/starfywiki.png"
- (λ (props)
- `((p "Founded on May 30, 2009, Starfy Wiki's one goal is to become the best source on Nintendo's elusive game series The Legendary Starfy. After gaining independence in 2011 with the help of Tappy and the wiki's original administrative team, the wiki still hopes to achieve its goal and be the best source of Starfy info for all present and future fans."))))
-
- (extwiki^
- '() 'default
- 'NIWA
- "StrategyWiki"
- "https://www.strategywiki.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/strategywiki.png"
- (λ (props)
- `((p "StrategyWiki was founded in December 2005 by former member Brandon Suit with the idea that the existing strategy guides on the Internet could be improved. Three years later, in December 2008, Scott Jacobi officially established Abxy LLC for the purpose of owning and operating StrategyWiki as a community. Their vision is to bring free, collaborative video game strategy guides to the masses, including Nintendo franchise strategy guides."))))
-
- (extwiki^
- '("mario" "themario" "imario" "supermarionintendo" "mariokart" "luigi-kart" "mario3") 'default
- 'NIWA
- "Super Mario Wiki"
- "https://www.mariowiki.com/"
- "https://niwanetwork.org/images/logos/mariowiki.png"
- (λ (props)
- `((p "Online since August 12, 2005, when it was founded by Steve Shinn, Super Mario Wiki has you covered for anything Mario, Donkey Kong, Wario, Luigi, Yoshi—the whole gang, in fact. With its own large community in its accompanying forum, Super Mario Wiki is not only a great encyclopedia, but a fansite for you to talk anything Mario."))))
-
- (extwiki^
- '("mario64") 'default
- 'NIWA
- "Ukikipedia"
- "https://ukikipedia.net/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/ukikipedia.png"
- (λ (props)
- `((p "Founded in 2018, Ukikipedia is a wiki focused on expert level knowledge of Super Mario 64, including detailed coverage of game mechanics, glitches, speedrunning, and challenges."))))
-
- (extwiki^
- '("advancewars") 'default
- 'NIWA
- "Wars Wiki"
- "https://www.warswiki.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/warswiki.png"
- (λ (props)
- `((p "Created in February 2009, Wars Wiki is a small wiki community with a large heart. Founded by JoJo and Wars Central, Wars Wiki is going strong on one of Nintendo's lesser known franchises. Wars Wiki is keen to contribute to NIWA, and we're proud to be able to support them. With the Wars Central community, including forums, it's definitely worth checking out."))))
-
- (extwiki^
- '("earthbound") 'default
- 'NIWA
- "WikiBound"
- "https://www.wikibound.info/wiki/WikiBound"
- "https://niwanetwork.org/images/logos/wikibound.png"
- (λ (props)
- `((p "Founded in early 2010 by Tacopill, WikiBound strives to create a detailed database on the Mother/EarthBound games, a quaint series only having two games officially released outside of Japan. Help spread the PK Love by editing WikiBound!"))))
-
- (extwiki^
- '("kirby") 'default
- 'NIWA
- "WiKirby"
- "https://wikirby.com/wiki/Kirby_Wiki"
- "https://niwanetwork.org/images/logos/wikirby.png"
- (λ (props)
- `((p "WiKirby. It's a wiki. About Kirby! Amidst the excitement of NIWA being founded, Josh LeJeune decided to create a Kirby Wiki, due to lack of a strong independent one online. Coming online on January 24, 2010, WiKirby continues its strong launch with a dedicated community and a daily growing source of Kirby based knowledge."))))
-
- (extwiki^
- '("xenoblade" "xenoseries" "xenogears" "xenosaga") 'parallel
- 'NIWA
- "Xeno Series Wiki"
- "https://www.xenoserieswiki.org/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/xenoserieswiki.png"
- (λ (props)
- `((p "Xeno Series Wiki was created February 4, 2020 by Sir Teatei Moonlight. While founded by the desire to have an independent wiki for Xenoblade, there was an interest in including the Xenogears and Xenosaga games within its focus as well. This wide range of coverage means it's always in need of new editors to help bolster its many subjects."))))
-
- (extwiki^
- '("zelda" "zelda-archive") 'default
- 'NIWA
- "Zelda Wiki"
- "https://zeldawiki.wiki/wiki/Main_Page"
- "https://niwanetwork.org/images/logos/zeldapedia.png"
- (λ (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."))))
-
- (extwiki^
- '("chrono") 'default
- 'SEIWA
- "Chrono Wiki"
- "https://www.chronowiki.org/wiki/Chrono_Wiki"
- "https://cdn.wikimg.net/en/chronowiki/images/5/59/Site-wiki.png"
- (λ (props) '((p "A free encyclopedia dedicated to Chrono Trigger, Chrono Cross, Radical Dreamers, and everything else related to the series. A long, rich history and a friendly, encouraging userbase makes this the best Chrono in the entire time/space continuum!"))))
-
- (extwiki^
- '("finalfantasy" "finalfantasyxv" "ffxiclopedia") 'parallel
- 'SEIWA
- "Final Fantasy Wiki"
- "https://finalfantasywiki.com/wiki/Main_Page"
- "https://cdn.finalfantasywiki.com/wiki.png"
- (λ (props) '((p "A new wiki focused on covering Square Enix's flagship franchise, the critically-acclaimed Final Fantasy series. The Final Fantasy Wiki was founded on January 12, 2020 as part of SEIWA and covers all things Final Fantasy and related franchises."))))
-
- (extwiki^
- '("kingdomhearts") 'default
- 'SEIWA
- "Kingdom Hearts Wiki"
- "https://www.khwiki.com/"
- "https://kh.wiki.gallery/images/b/bc/Wiki.png"
- (λ (props) '((p "The Kingdom Hearts Wiki attempts to document all things related to the Kingdom Hearts series, from elements of storyline to gameplay. The site was originally founded on April 1, 2006 on Wikia and became independent on February 9, 2011. Since this time, the community of the KHWiki strives to be the most professional and comprehensive Kingdom Hearts resource in the world."))))
-
- (extwiki^
- '("squareenix") 'default
- 'SEIWA
- "Square Enix Wiki"
- "https://wiki.seiwanetwork.org/wiki/Main_Page"
- "https://cdn.seiwanetwork.org/thumb/9/94/Square_Enix_Wiki_Logo.png/200px-Square_Enix_Wiki_Logo.png"
- (λ (props) '((p "The Square Enix Wiki was founded on February 8, 2012, and is an up-and-coming wiki project created by SEIWA. It focuses on covering all things Square Enix, from its video game series to its physical publications to its most notable employees and work as a company."))))
-
- (extwiki^
- '("terraria") 'default
- 'Terraria
- "Official Terraria Wiki"
- "https://terraria.wiki.gg/wiki/Terraria_Wiki"
- "https://terraria.wiki.gg/images/5/5a/App_icon_1.3_Update.png"
- (λ (props)
- `()))
-
- (extwiki^
- '("calamitymod" "calamity-mod") 'empty
- 'Calamity_Mod
- "Official Calamity Mod Wiki"
- "https://calamitymod.wiki.gg/wiki/Calamity_Mod_Wiki"
- #f
- #f)
-
- (extwiki^
- '("ark" "ark-survival-evolved-archive") 'default
- 'ARK
- "ARK Community Wiki"
- "https://ark.wiki.gg/wiki/ARK_Survival_Evolved_Wiki"
- "https://ark.wiki.gg/images/e/e6/Site-logo.png"
- (λ (props)
- `((p "The official ARK: Survival Evolved Wiki launched in 2016. In April 2022 it moved to wiki.gg's hosting to improve creative control and the overall browsing experience."))))
-
- (extwiki^
- '("runescape") 'default
- 'RuneScape
- "RuneScape Wiki"
- "https://runescape.wiki/w/Main_Page"
- "https://runescape.wiki/images/Wiki.png"
- (λ (props)
- `((p "The RuneScape Wiki was founded on April 8, 2005. In October 2018, the wiki left Fandom (then Wikia), citing their apathy towards the wiki and excessive advertisements."))))
-
- (extwiki^
- '("oldschoolrunescape") 'default
- 'RuneScape
- "Old School RuneScape Wiki"
- "https://oldschool.runescape.wiki/w/Main_Page"
- "https://oldschool.runescape.wiki/images/Wiki.png"
- (λ (props)
- `((p "The Old School RuneScape Wiki was founded on February 14, 2013. In October 2018, the RuneScape Wiki left Fandom (then Wikia), citing their apathy towards the wiki and excessive advertisements, with the Old School RuneScape Wiki following suit."))))
-
- (extwiki^
- '("runescapeclassic") 'default
- 'RuneScape
- "RuneScape Classic Wiki"
- "https://classic.runescape.wiki/w/Main_Page"
- "https://classic.runescape.wiki/images/Wiki.png"
- (λ (props)
- `((p "The Old School RuneScape Wiki was founded on April 19, 2009. In October 2018, the RuneScape Wiki left Fandom (then Wikia), citing their apathy towards the wiki and excessive advertisements, with the RuneScape Classic Wiki following suit."))))
-
- (extwiki^
- '("astroneer") 'default
- 'Astroneer
- "Astroneer Wiki"
- "https://astroneer.wiki.gg/wiki/Astroneer_Wiki"
- "https://astroneer.wiki.gg/images/7/74/Icon_Astroneer.png"
- (λ (props)
- `((p "“Fandom bought Gamepedia and forced a migration, with their restricted, ad-heavy appearance, and other annoying features that we could not remove, the wiki grew slow and annoying to use, especially for logged out users.")
- (p "“We decided to move away from Fandom to Wiki.gg, which returns the wiki to how it used to be on gamepedia, without the ads spamming and forced videos.”"))))
-
- (extwiki^
- '("minecraft") 'default
- 'Minecraft
- "The Minecraft Wiki"
- "https://minecraft.wiki/w/Minecraft_Wiki"
- "https://minecraft.wiki/images/Wiki.png"
- (λ (props)
- `()))
-
- (extwiki^
- '("tardis") 'default
- 'Tardis
- "TARDIS Wiki"
- "https://tardis.wiki/wiki/Doctor_Who_Wiki"
- "https://tardis.wiki/w/images/Tardis_Images/e/e6/Site-logo.png"
- (λ (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 Clancy’s 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
- (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^ '("chivalry" "chivalry2") 'empty 'empty "Official Chivalry Wiki" "https://chivalry.wiki.gg/wiki/Chivalry_Wiki" #f #f)
- (extwiki^ '("clockup") 'empty 'empty "CLOCKUP WIKI" "https://en.clockup.wiki/wiki/Main_Page" #f #f)
- (extwiki^ '("half-life") 'empty 'empty "Combine OverWiki" "https://combineoverwiki.net/wiki/Main_Page" #f #f)
- (extwiki^ '("coromon") 'empty 'empty "Coromon Wiki" "https://coromon.wiki.gg/wiki/Coromon_Wiki" #f #f)
- (extwiki^ '("cosmoteer") 'empty 'empty "Cosmoteer Wiki" "https://cosmoteer.wiki.gg/wiki/Cosmoteer_Wiki" #f #f)
- (extwiki^ '("criticalrole") 'empty 'empty "Encylopedia Exandria" "https://criticalrole.miraheze.org/wiki/Main_Page" #f #f)
- (extwiki^ '("cuphead") 'empty 'empty "Cuphead Wiki" "https://cuphead.wiki.gg/wiki/Cuphead_Wiki" #f #f)
- (extwiki^ '("darkdeity") 'empty 'empty "Dark Deity Wiki" "https://darkdeity.wiki.gg/wiki/Dark_Deity_Wiki" #f #f)
- (extwiki^ '("deeprockgalactic") 'empty 'empty "Deep Rock Galactic Wiki" "https://deeprockgalactic.wiki.gg/wiki/Deep_Rock_Galactic_Wiki" #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^ '("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^ '("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^ '("jojo" "jojos") 'empty 'empty "JoJo's Bizarre Encyclopedia" "https://jojowiki.com/" #f #f)
- (extwiki^ '("legiontd2") 'empty 'empty "Legion TD 2 Wiki" "https://legiontd2.wiki.gg/wiki/Legion_TD_2_Wiki" #f #f)
- (extwiki^ '("noita") 'empty 'empty "Noita Wiki" "https://noita.wiki.gg/wiki/Noita_Wiki" #f #f)
- (extwiki^ '("pathofexile") 'empty 'empty "Official Path of Exile Wiki" "https://www.poewiki.net/wiki/Path_of_Exile_Wiki" #f #f)
- (extwiki^ '("projectarrhythmia") 'empty 'empty "Project Arrhythmia Wiki" "https://projectarrhythmia.wiki.gg/wiki/Project_Arrhythmia_Wiki" #f #f)
- (extwiki^ '("sandsofaura") 'empty 'empty "Official Sands of Aura Wiki" "https://sandsofaura.wiki.gg/wiki/Sands_of_Aura_Wiki" #f #f)
- (extwiki^ '("seaofthieves") 'empty 'empty "Official Sea of Thieves Wiki" "https://seaofthieves.wiki.gg/wiki/Sea_of_Thieves" #f #f)
- (extwiki^ '("sonsoftheforest") 'empty 'empty "Sons of the Forest Wiki" "https://sonsoftheforest.wiki.gg/wiki/Sons_of_the_Forest_Wiki" #f #f)
- (extwiki^ '("stardewvalley") 'empty 'empty "Official Stardew Valley Wiki" "https://www.stardewvalleywiki.com/Stardew_Valley_Wiki" #f #f)
- (extwiki^ '("steamworld") 'empty 'empty "Official SteamWorld Wiki" "https://steamworld.wiki.gg/wiki/SteamWorld_Wiki" #f #f)
- (extwiki^ '("teamfortress") 'empty 'empty "Official Team Fortress Wiki" "https://wiki.teamfortress.com/wiki/Main_Page" #f #f)
- (extwiki^ '("temtem") 'empty 'empty "Official Temtem Wiki" "https://temtem.wiki.gg/wiki/Temtem_Wiki" #f #f)
- (extwiki^ '("terrariamods") 'empty 'empty "Official Terraria Mods Wiki" "https://terrariamods.wiki.gg/wiki/Terraria_Mods_Wiki" #f #f)
- (extwiki^ '("thoriummod") 'empty 'empty "Official Thorium Mod Wiki" "https://thoriummod.wiki.gg/wiki/Thorium_Mod_Wiki" #f #f)
- (extwiki^ '("totherescue") 'empty 'empty "To The Rescue!" "https://totherescue.wiki.gg/wiki/To_The_Rescue%21_Wiki" #f #f)
- (extwiki^ '("touhou") 'empty 'empty "Touhou Wiki" "https://en.touhouwiki.net/wiki/Touhou_Wiki" #f #f)
- (extwiki^ '("undermine") 'empty 'empty "Official UnderMine Wiki" "https://undermine.wiki.gg/wiki/UnderMine_Wiki" #f #f)
- (extwiki^ '("westofloathing" "loathing") 'empty 'empty "Wiki of Loathing" "https://loathing.wiki.gg/wiki/Wiki_of_Loathing" #f #f)
- (extwiki^ '("willyousnail") 'empty 'empty "Official Will You Snail Wiki" "https://willyousnail.wiki.gg/wiki/Will_You_Snail_Wiki" #f #f)
- (extwiki^ '("yumenikki" "yume-nikki-dream-diary") 'empty 'empty "Yume Wiki" "https://yume.wiki/Main_Page" #f #f)))
-
-;; get the current dataset so it can be stored above
-(module+ fetch
- (require racket/generator
- racket/list
- net/http-easy
- html-parsing
- "../lib/xexpr-utils.rkt")
- (define r (get "https://www.niwanetwork.org/members/"))
- (define x (html->xexp (bytes->string/utf-8 (response-body r))))
- (define english ((query-selector (λ (e a c) (equal? (get-attribute 'id a) "content1")) x)))
- (define gen (query-selector (λ (e a c) (has-class? "member" a)) english))
- (for/list ([item (in-producer gen #f)])
- (define links (query-selector (λ (e a c) (eq? e 'a)) item))
- (define url (get-attribute 'href (bits->attributes (links))))
- (define title (third (links)))
- (define icon (get-attribute 'src (bits->attributes ((query-selector (λ (e a c) (eq? e 'img)) item)))))
- (define description (second ((query-selector (λ (e a c) (eq? e 'p)) item))))
- (list '() title url icon description)))
diff --git a/src/extwiki-generic.rkt b/src/extwiki-generic.rkt
deleted file mode 100644
index 113b139..0000000
--- a/src/extwiki-generic.rkt
+++ /dev/null
@@ -1,130 +0,0 @@
-#lang racket/base
-(require racket/list
- racket/match
- racket/string
- memo
- net/http-easy
- html-parsing
- "../lib/pure-utils.rkt"
- "../lib/syntax.rkt"
- "../lib/url-utils.rkt"
- "../lib/xexpr-utils.rkt")
-
-(provide
- get-redirect-content)
-
-(module+ test
- (require rackunit))
-
-;; fandom wikinames * Title * Main Page * Search page override * API endpoint override
-(define wikis
- '(((gallowmere) "MediEvil Wiki" "https://medievil.wiki/w/Main_Page" #f #f)
- ((fallout) "Fallout Wiki" "https://fallout.wiki/wiki/Fallout_Wiki" #f "https://fallout.wiki/api.php")
- ((drawntolife) "Wapopedia" "https://drawntolife.wiki/en/Main_Page" #f "https://drawntolife.wiki/w/api.php")
- ))
-
-(define wikis-hash (make-hash))
-(for ([w wikis])
- (for ([wikiname (car w)])
- (hash-set! wikis-hash (symbol->string wikiname) w)))
-(module+ test
- (check-equal? (cadr (hash-ref wikis-hash "gallowmere"))
- "MediEvil Wiki"))
-
-(define (parse-table table)
- (define rows (query-selector (λ (t a c) (eq? t 'tr)) table))
- (define header-row (rows))
- (define column-names
- (for/list ([th (in-producer (query-selector (λ (t a c) (eq? t 'th)) header-row) #f)])
- (string->symbol (string-downcase (string-trim (findf string? th))))))
- (define data-row (rows))
- (for/hasheq ([col-name column-names]
- [col-value (in-producer (query-selector (λ (t a c) (eq? t 'td)) data-row) #f)])
- (values col-name (filter element-is-content? (cdr col-value)))))
-(module+ test
- (check-equal? (parse-table (html->xexp "