Compare commits

..

44 commits

Author SHA1 Message Date
0d03783bbf
() 2022-10-09 14:49:46 +07:00
c3179e71dc
more test 2022-10-09 14:45:36 +07:00
96af163773
fmt 2022-10-09 14:25:59 +07:00
bab6c56205
oops 2022-10-09 14:25:08 +07:00
99be807b73
more ` 2022-10-09 14:23:07 +07:00
50719142bc
fix syntax 2022-10-09 14:22:23 +07:00
19aeeea60f
more stuff 2022-10-09 14:21:28 +07:00
ba806d0633
simple tests 2022-10-09 14:16:15 +07:00
bc07a37bf7
Set Referrer-Policy to no-referrer
Fandom sends a fake 404 to media if there's a Referer header that has an origin
that's not Fandom. However, we can choose not to send the header by setting
Referrer-Policy. See also:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
2022-10-09 14:08:20 +07:00
51bf087b30
raco fmt 2022-10-09 10:49:10 +07:00
1a996e7c89
odd 2022-10-09 10:45:37 +07:00
fb21700517
shrug 2022-10-09 10:43:29 +07:00
f2de0cc11f
url 2022-10-08 23:14:57 +07:00
e845cc460b
content-type 2022-10-08 23:14:02 +07:00
915b4a6ad5
f 2022-10-08 22:55:18 +07:00
2cd489658a
prefix 2022-10-08 22:52:23 +07:00
cb2fb07b24
ogg 2022-10-08 22:46:38 +07:00
f6b448ae8f
idfk 2022-10-08 22:42:43 +07:00
1c676fd5a0
??? 2022-10-08 22:41:43 +07:00
85e23c803a
' 2022-10-08 22:40:47 +07:00
881b95bde3
ok 2022-10-08 22:38:44 +07:00
6d2f5904fe
`? 2022-10-08 22:36:13 +07:00
91a3d7255f
easy: 2022-10-08 22:28:22 +07:00
ff18bda668
oops 2022-10-08 22:27:28 +07:00
04ed98fb4b
lost 2022-10-08 22:26:17 +07:00
fd4d65abb2
` 2022-10-08 21:37:19 +07:00
1558f9f541
preprocess 2022-10-08 21:16:38 +07:00
c2c699ec8f
))) 2022-10-08 21:15:02 +07:00
21f4f7acbc
)) 2022-10-08 21:14:11 +07:00
d336307921
) 2022-10-08 21:13:19 +07:00
db0158f237
image desc 2022-10-08 21:11:38 +07:00
940b6e01db
t 2022-10-08 17:56:56 +07:00
7d8763b308
? 2022-10-08 17:34:11 +07:00
80459eccad
H 2022-10-08 17:09:13 +07:00
f6e011e687
, 2022-10-08 16:21:02 +07:00
ce496dbba1
ff 2022-10-08 16:17:10 +07:00
b7424a7649
f 2022-10-08 16:16:13 +07:00
01363b366a
bbb 2022-10-08 16:15:03 +07:00
8b8a9c5e09
bb 2022-10-08 16:12:30 +07:00
fe87ff26c5
b 2022-10-08 15:57:33 +07:00
600338aef0
` 2022-10-08 15:44:56 +07:00
00da2efd7a
article... 2022-10-08 15:42:41 +07:00
0148c1c3f9
idfk 2022-10-08 15:42:00 +07:00
5fb7301ce1
Add support for File: pages
Fixes https://lists.sr.ht/~cadence/breezewiki-discuss/%3Cb2835a70-5118-4df0-90c9-4333486a4b69%40nixnetmail.com%3E
2022-10-08 15:35:35 +07:00

View file

@ -25,17 +25,7 @@
(module+ test
(require rackunit)
(define test-media-detail
'#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))))
'#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))))
(define (url-content-type url)
(log-outgoing url)
@ -73,7 +63,8 @@
#:wikiname wikiname
#:title title
#:license license
`(div ,(if (non-empty-string? video-embed-code)
`(div
,(if (non-empty-string? video-embed-code)
(update-tree-wiki (html->xexp (preprocess-html-wiki video-embed-code)) wikiname)
(get-media-html image-url image-content-type))
(p ,(if (non-empty-string? video-embed-code)
@ -88,8 +79,7 @@
(define page-path (jp "/title" article))
(define title (jp "/titleText" article page-path))
`(span ,(if (eq? (car smaller-article-list) article) "" ", ")
(a (@ (href ,(format "/~a/wiki/~a" wikiname page-path)))
,title)))
(a (@ (href ,(format "/~a/wiki/~a" wikiname page-path))) ,title)))
smaller-article-list)
,(if (eq? article-list-is-smaller 1) "" "."))
`""))
@ -156,10 +146,9 @@
(check-equal? (get-media-html "https://example.com" #f) `""))
(module+ test
(parameterize ([(config-parameter 'strict_proxy) "true"])
(check-not-false
((query-selector
(attribute-selector 'src "/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fexamplefile")
(generate-results-page #:source-url ""
(check-not-false ((query-selector (attribute-selector 'src "/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fexamplefile")
(generate-results-page
#:source-url ""
#:wikiname "test"
#:title "File:Example file"
#:media-detail test-media-detail