git ssb

0+

cel / ssb-wikimedia



Commit a9397726c101b1c2984678dd09d09f3a57d1cfb5

Handle URLs even if they don't include "/wiki" in path

cel committed on 12/1/2019, 5:36:41 AM
Parent: 86215c0311074ce998b6e5f88651f86e3d5e7a1e

Files changed

bin.jschanged
notes.txtchanged
bin.jsView
@@ -154,14 +154,14 @@
154154 }
155155 }
156156
157157 var pagesInfo = urls.map(function (page) {
158- var m = /^(.*?)\/wiki\/(.*)$/.exec(page)
158 + var m = /^(https?:\/\/.*?)(\/wiki)?\/(.*)$/.exec(page)
159159 if (!m) throw 'Unable to parse page URL ' + page
160160 return {
161161 site: m[1] + '/',
162- api: m[1] + '/w/api.php',
163- title: m[2]
162 + api: m[1] + (m[2] ? '/w' : '/wiki') + '/api.php',
163 + title: m[3]
164164 }
165165 })
166166 var pagesInfoByApi = {}
167167 pagesInfo.forEach(function (pageInfo) {
notes.txtView
@@ -10,4 +10,17 @@
1010
1111
1212 pageLink: hash(site '-' title '-' pageid '-' ns)
1313 pageLink: hash(site '\t' title)
14 +
15 +https://indieweb.org/Secure_Scuttlebutt
16 +https://indieweb.org/wiki/index.php?title=Secure_Scuttlebutt
17 +https://indieweb.org/wiki/index.php?title=Secure_Scuttlebutt&action=history
18 +https://indieweb.org/wiki/api.php
19 +
20 +https://en.wikipedia.org/wiki/Secure_Scuttlebutt
21 +https://en.wikipedia.org/w/index.php?title=Secure_Scuttlebutt
22 +https://en.wikipedia.org/w/index.php?title=Secure_Scuttlebutt&action=history
23 +https://en.wikipedia.org/w/api.php
24 +
25 +https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:$wgCanonicalServer
26 +https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:$wgScriptPath

Built with git-ssb-web