forked from cadence/breezewiki
Use default siteinfo when online wiki not found
This commit is contained in:
parent
d2765c2a78
commit
0fd0efc3f2
1 changed files with 7 additions and 5 deletions
|
@ -62,11 +62,13 @@
|
||||||
("siprop" . "general|rightsinfo")
|
("siprop" . "general|rightsinfo")
|
||||||
("format" . "json")
|
("format" . "json")
|
||||||
("formatversion" . "2"))))
|
("formatversion" . "2"))))
|
||||||
|
(cond [(= (easy:response-status-code res) 200)
|
||||||
(define data (easy:response-json res))
|
(define data (easy:response-json res))
|
||||||
(siteinfo^ (jp "/query/general/sitename" data)
|
(siteinfo^ (jp "/query/general/sitename" data)
|
||||||
(second (regexp-match #rx"/wiki/(.*)" (jp "/query/general/base" data)))
|
(second (regexp-match #rx"/wiki/(.*)" (jp "/query/general/base" data)))
|
||||||
(license^ (jp "/query/rightsinfo/text" data)
|
(license^ (jp "/query/rightsinfo/text" data)
|
||||||
(jp "/query/rightsinfo/url" data)))]))
|
(jp "/query/rightsinfo/url" data)))]
|
||||||
|
[else siteinfo-default])]))
|
||||||
|
|
||||||
(define/memoize (head-data-getter wikiname) #:hash hash
|
(define/memoize (head-data-getter wikiname) #:hash hash
|
||||||
;; data will be stored here, can be referenced by the memoized closure
|
;; data will be stored here, can be referenced by the memoized closure
|
||||||
|
|
Loading…
Reference in a new issue