Commit a9397726c101b1c2984678dd09d09f3a57d1cfb5
Handle URLs even if they don't include "/wiki" in path
cel committed on 12/1/2019, 5:36:41 AMParent: 86215c0311074ce998b6e5f88651f86e3d5e7a1e
Files changed
bin.js | changed |
notes.txt | changed |
bin.js | ||
---|---|---|
@@ -154,14 +154,14 @@ | ||
154 | 154 … | } |
155 | 155 … | } |
156 | 156 … | |
157 | 157 … | var pagesInfo = urls.map(function (page) { |
158 | - var m = /^(.*?)\/wiki\/(.*)$/.exec(page) | |
158 … | + var m = /^(https?:\/\/.*?)(\/wiki)?\/(.*)$/.exec(page) | |
159 | 159 … | if (!m) throw 'Unable to parse page URL ' + page |
160 | 160 … | return { |
161 | 161 … | 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] | |
164 | 164 … | } |
165 | 165 … | }) |
166 | 166 … | var pagesInfoByApi = {} |
167 | 167 … | pagesInfo.forEach(function (pageInfo) { |
notes.txt | ||
---|---|---|
@@ -10,4 +10,17 @@ | ||
10 | 10 … | |
11 | 11 … | |
12 | 12 … | pageLink: hash(site '-' title '-' pageid '-' ns) |
13 | 13 … | 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