Compare commits

..

9 commits

Author SHA1 Message Date
411ebb3ab6
Hide slideshows 2024-01-09 17:38:02 +11:00
d5f992b7d8
Fix scrolling to sections if a tab's hash coincides with one
ben10/wiki/Alien_X_(Classic)#Appearances
2024-01-09 17:38:01 +11:00
2277c53956
Prevent making duplicate history entries 2024-01-09 17:38:01 +11:00
e8923d3f5c
Prevent linking to tabs with no IDs 2024-01-09 17:38:01 +11:00
c9eba0b5c3
Add the ability to specify/open the last open tab in the URL 2024-01-09 17:38:01 +11:00
d345fb8ff4
Add better support for tabs
Some pages break without actual tab support, such as
https://breezewiki.com/ben10/wiki/Ultimatrix_(Original)#Modes

This change aims to work with old browsers (such as Firefox for Android 68)
and browsers with Javascript disabled (by showing all tab contents and hiding
the tab bar, i.e. how tabs work before this change).
2024-01-09 17:37:57 +11:00
b8a6c5198d Fix more redirects in offline mode 2024-01-09 17:35:26 +13:00
0fed724604 Fix redirects to category pages in offline mode 2024-01-09 17:13:04 +13:00
3942350468 Fix error on a redirect page with no link
https://lists.sr.ht/~cadence/breezewiki-discuss/%3CCY2G0E3G55N3.ANW2QREUS5SO%40nixnetmail.com%3E
2024-01-09 16:41:48 +13:00
2 changed files with 14 additions and 7 deletions

View file

@ -98,16 +98,19 @@
#:head-data head-data #:head-data head-data
#:siteinfo (siteinfo-fetch wikiname) #:siteinfo (siteinfo-fetch wikiname)
)) ))
(define redirect-msg ((query-selector (attribute-selector 'class "redirectMsg") body)))
(define redirect-query-parameter (dict-ref (url-query (request-uri req)) 'redirect "yes")) (define redirect-query-parameter (dict-ref (url-query (request-uri req)) 'redirect "yes"))
(define redirect-msg ((query-selector (attribute-selector 'class "redirectMsg") body)))
(define redirect-msg-a (if redirect-msg
((query-selector (λ (t a c) (eq? t 'a)) redirect-msg))
#f))
(define headers (define headers
(build-headers (build-headers
always-headers always-headers
; redirect-query-parameter: only the string "no" is significant: ; redirect-query-parameter: only the string "no" is significant:
; https://github.com/Wikia/app/blob/fe60579a53f16816d65dad1644363160a63206a6/includes/Wiki.php#L367 ; https://github.com/Wikia/app/blob/fe60579a53f16816d65dad1644363160a63206a6/includes/Wiki.php#L367
(when (and redirect-msg (when (and redirect-msg-a
(not (equal? redirect-query-parameter "no"))) (not (equal? redirect-query-parameter "no")))
(let* ([dest (get-attribute 'href (bits->attributes ((query-selector (λ (t a c) (eq? t 'a)) redirect-msg))))] (let* ([dest (get-attribute 'href (bits->attributes redirect-msg-a))]
[value (bytes-append #"0;url=" (string->bytes/utf-8 dest))]) [value (bytes-append #"0;url=" (string->bytes/utf-8 dest))])
(header #"Refresh" value))))) (header #"Refresh" value)))))
(when (config-true? 'debug) (when (config-true? 'debug)
@ -123,7 +126,8 @@
;; page not found on disk, perhaps it's a redirect? redirects are stored in the database ;; page not found on disk, perhaps it's a redirect? redirects are stored in the database
(var target (query-maybe-value* "select redirect from page where wikiname = ? and basename = ?" wikiname basename)) (var target (query-maybe-value* "select redirect from page where wikiname = ? and basename = ?" wikiname basename))
[target [target
(generate-redirect (basename->name-for-query target))] ; don't url decode the target, or Category: pages will be interpreted as a protocol
(generate-redirect (format "/~a/wiki/~a" wikiname (regexp-replace* #rx"#" target "/")))]
;; breezewiki doesn't have the page archived, see if we can make a network request for it ;; breezewiki doesn't have the page archived, see if we can make a network request for it
[(not (config-true? 'feature_offline::only)) [(not (config-true? 'feature_offline::only))

View file

@ -80,16 +80,19 @@
#:title title #:title title
#:head-data head-data #:head-data head-data
#:siteinfo siteinfo)) #:siteinfo siteinfo))
(define redirect-msg ((query-selector (attribute-selector 'class "redirectMsg") body)))
(define redirect-query-parameter (dict-ref (url-query (request-uri req)) 'redirect "yes")) (define redirect-query-parameter (dict-ref (url-query (request-uri req)) 'redirect "yes"))
(define redirect-msg ((query-selector (attribute-selector 'class "redirectMsg") body)))
(define redirect-msg-a (if redirect-msg
((query-selector (λ (t a c) (eq? t 'a)) redirect-msg))
#f))
(define headers (define headers
(build-headers (build-headers
always-headers always-headers
; redirect-query-parameter: only the string "no" is significant: ; redirect-query-parameter: only the string "no" is significant:
; https://github.com/Wikia/app/blob/fe60579a53f16816d65dad1644363160a63206a6/includes/Wiki.php#L367 ; https://github.com/Wikia/app/blob/fe60579a53f16816d65dad1644363160a63206a6/includes/Wiki.php#L367
(when (and redirect-msg (when (and redirect-msg-a
(not (equal? redirect-query-parameter "no"))) (not (equal? redirect-query-parameter "no")))
(let* ([dest (get-attribute 'href (bits->attributes ((query-selector (λ (t a c) (eq? t 'a)) redirect-msg))))] (let* ([dest (get-attribute 'href (bits->attributes redirect-msg-a))]
[value (bytes-append #"0;url=" (string->bytes/utf-8 dest))]) [value (bytes-append #"0;url=" (string->bytes/utf-8 dest))])
(header #"Refresh" value))))) (header #"Refresh" value)))))
(when (config-true? 'debug) (when (config-true? 'debug)