forked from cadence/breezewiki
Compare commits
44 commits
bf80692c4e
...
0d03783bbf
Author | SHA1 | Date | |
---|---|---|---|
0d03783bbf | |||
c3179e71dc | |||
96af163773 | |||
bab6c56205 | |||
99be807b73 | |||
50719142bc | |||
19aeeea60f | |||
ba806d0633 | |||
bc07a37bf7 | |||
51bf087b30 | |||
1a996e7c89 | |||
fb21700517 | |||
f2de0cc11f | |||
e845cc460b | |||
915b4a6ad5 | |||
2cd489658a | |||
cb2fb07b24 | |||
f6b448ae8f | |||
1c676fd5a0 | |||
85e23c803a | |||
881b95bde3 | |||
6d2f5904fe | |||
91a3d7255f | |||
ff18bda668 | |||
04ed98fb4b | |||
fd4d65abb2 | |||
1558f9f541 | |||
c2c699ec8f | |||
21f4f7acbc | |||
d336307921 | |||
db0158f237 | |||
940b6e01db | |||
7d8763b308 | |||
80459eccad | |||
f6e011e687 | |||
ce496dbba1 | |||
b7424a7649 | |||
01363b366a | |||
8b8a9c5e09 | |||
fe87ff26c5 | |||
600338aef0 | |||
00da2efd7a | |||
0148c1c3f9 | |||
5fb7301ce1 |
1 changed files with 31 additions and 42 deletions
|
@ -25,17 +25,7 @@
|
||||||
(module+ test
|
(module+ test
|
||||||
(require rackunit)
|
(require rackunit)
|
||||||
(define test-media-detail
|
(define test-media-detail
|
||||||
'#hasheq((fileTitle . "Example file")
|
'#hasheq((fileTitle . "Example file") (videoEmbedCode . "") (imageUrl . "https://static.wikia.nocookie.net/examplefile") (rawImageUrl . "https://static.wikia.nocookie.net/examplefile") (userName . "blankie") (isPostedIn . #t) (smallerArticleList . (#hasheq((title . "Example_article") (titleText . "Example article")))) (articleListIsSmaller . 0) (exists . #t) (imageDescription . #f))))
|
||||||
(videoEmbedCode . "")
|
|
||||||
(imageUrl . "https://static.wikia.nocookie.net/examplefile")
|
|
||||||
(rawImageUrl . "https://static.wikia.nocookie.net/examplefile")
|
|
||||||
(userName . "blankie")
|
|
||||||
(isPostedIn . #t)
|
|
||||||
(smallerArticleList . (#hasheq((title . "Example_article")
|
|
||||||
(titleText . "Example article"))))
|
|
||||||
(articleListIsSmaller . 0)
|
|
||||||
(exists . #t)
|
|
||||||
(imageDescription . #f))))
|
|
||||||
|
|
||||||
(define (url-content-type url)
|
(define (url-content-type url)
|
||||||
(log-outgoing url)
|
(log-outgoing url)
|
||||||
|
@ -73,29 +63,29 @@
|
||||||
#:wikiname wikiname
|
#:wikiname wikiname
|
||||||
#:title title
|
#:title title
|
||||||
#:license license
|
#:license license
|
||||||
`(div ,(if (non-empty-string? video-embed-code)
|
`(div
|
||||||
(update-tree-wiki (html->xexp (preprocess-html-wiki video-embed-code)) wikiname)
|
,(if (non-empty-string? video-embed-code)
|
||||||
(get-media-html image-url image-content-type))
|
(update-tree-wiki (html->xexp (preprocess-html-wiki video-embed-code)) wikiname)
|
||||||
(p ,(if (non-empty-string? video-embed-code)
|
(get-media-html image-url image-content-type))
|
||||||
`""
|
(p ,(if (non-empty-string? video-embed-code)
|
||||||
`(span (a (@ (href ,maybe-proxied-raw-image-url)) "View original file") ". "))
|
`""
|
||||||
"Added by "
|
`(span (a (@ (href ,maybe-proxied-raw-image-url)) "View original file") ". "))
|
||||||
(a (@ (href ,(format "/~a/wiki/User:~a" wikiname username))) ,username)
|
"Added by "
|
||||||
"."
|
(a (@ (href ,(format "/~a/wiki/User:~a" wikiname username))) ,username)
|
||||||
,(if is-posted-in
|
"."
|
||||||
`(span " Posted in "
|
,(if is-posted-in
|
||||||
,@(map (λ (article)
|
`(span " Posted in "
|
||||||
(define page-path (jp "/title" article))
|
,@(map (λ (article)
|
||||||
(define title (jp "/titleText" article page-path))
|
(define page-path (jp "/title" article))
|
||||||
`(span ,(if (eq? (car smaller-article-list) article) "" ", ")
|
(define title (jp "/titleText" article page-path))
|
||||||
(a (@ (href ,(format "/~a/wiki/~a" wikiname page-path)))
|
`(span ,(if (eq? (car smaller-article-list) article) "" ", ")
|
||||||
,title)))
|
(a (@ (href ,(format "/~a/wiki/~a" wikiname page-path))) ,title)))
|
||||||
smaller-article-list)
|
smaller-article-list)
|
||||||
,(if (eq? article-list-is-smaller 1) "…" "."))
|
,(if (eq? article-list-is-smaller 1) "…" "."))
|
||||||
`""))
|
`""))
|
||||||
,(if (string? image-description)
|
,(if (string? image-description)
|
||||||
(update-tree-wiki (html->xexp (preprocess-html-wiki image-description)) wikiname)
|
(update-tree-wiki (html->xexp (preprocess-html-wiki image-description)) wikiname)
|
||||||
""))))
|
""))))
|
||||||
|
|
||||||
(define (page-file req)
|
(define (page-file req)
|
||||||
(define wikiname (path/param-path (first (url-path (request-uri req)))))
|
(define wikiname (path/param-path (first (url-path (request-uri req)))))
|
||||||
|
@ -156,11 +146,10 @@
|
||||||
(check-equal? (get-media-html "https://example.com" #f) `""))
|
(check-equal? (get-media-html "https://example.com" #f) `""))
|
||||||
(module+ test
|
(module+ test
|
||||||
(parameterize ([(config-parameter 'strict_proxy) "true"])
|
(parameterize ([(config-parameter 'strict_proxy) "true"])
|
||||||
(check-not-false
|
(check-not-false ((query-selector (attribute-selector 'src "/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fexamplefile")
|
||||||
((query-selector
|
(generate-results-page
|
||||||
(attribute-selector 'src "/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fexamplefile")
|
#:source-url ""
|
||||||
(generate-results-page #:source-url ""
|
#:wikiname "test"
|
||||||
#:wikiname "test"
|
#:title "File:Example file"
|
||||||
#:title "File:Example file"
|
#:media-detail test-media-detail
|
||||||
#:media-detail test-media-detail
|
#:image-content-type "image/jpeg"))))))
|
||||||
#:image-content-type "image/jpeg"))))))
|
|
||||||
|
|
Loading…
Reference in a new issue