[07:23:36] [telegram] https://t.me/+gX_4SNyiSMcwMDlk [20:36:00] [telegram] i followed the instructions, but something (probably something obvious šŸ˜œ) is still missing, as I'm getting the err: "Access to fetch at 'https://www.mediawiki.org/w/api.php?action=query&meta=userinfo' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested res [20:36:47] [telegram] I'm passing the token as an header, as "Authorization: "Bearer " + configData["Access token"]," [20:40:32] [telegram] not sure if I can send the request from "http://localhost:3000" at all [21:08:09] [telegram] I think setting the request mode to no-cors, as suggested in the error, might be the solution ā€“ since youā€™re not relying on cookies for authentication in the first place [21:08:58] [telegram] (so that would be `mode: 'no-cors'` in the second `fetch()` argument, I believe, assuming youā€™re using fetch) [21:09:10] [telegram] but I might be wrong, Iā€™m not very familiar with OAuth 2 [22:03:14] [telegram] I could use some regex help... i have a regex to change `[[link]]` into `[[Wx/xx/link]].` But I don't want that to happen inside `` tags. So I need a regex to _not match_ `[[link]]` when preceded by `` (and the `` doesn't necessarily appear right before the link, there could be more characters in between), but to match when the `` is followed by a ``. [22:03:16] [telegram] [22:03:17] [telegram] This is the closest I've got, but I don't know how to make it match the last two test cases (the final one only doesn't match because of the regex's s flag, but I need that s flag because reasons): https://regex101.com/r/tcqbte/1 [22:03:20] [telegram] /delete@wikilinksbot [22:08:49] [telegram] it returns an "opaque" answer, aparently it's empty and unusable šŸ˜• (re @lucaswerkmeister: (so that would be mode: 'no-cors' in the second fetch() argument, I believe, assuming youā€™re using fetch)) [22:12:17] [telegram] hm, can you see the request and response headers in the network panel at least, to see whatā€™s going on? (re @Paulo_Darwin: it returns an "opaque" answer, aparently it's empty and unusable šŸ˜•) [22:13:00] [telegram] does it absolutely have to be done with a regex? (you know the parse HTML with regex (https://stackoverflow.com/a/1732454/1420237) answer, right? ;) ) (re @jhsoby: I could use some regex help... i have a regex to change [[link]] into [[Wx/xx/link]]. But I don't want that to happen inside [telegram] if I couldnā€™t use mwparserfromhell, I would probably try to do that by replacing `.*?` (non-greedy in the middle!) with some placeholder, then processing the wikitext, then replacing the placeholders with the original again [22:13:59] [telegram] yes, I can (re @lucaswerkmeister: hm, can you see the request and response headers in the network panel at least, to see whatā€™s going on?) [22:14:00] [telegram] and then the middle part doesnā€™t have to worry about nowiki [22:14:48] [telegram] (inb4 someone tells me `` tags can sometimes have attributes so they wouldnā€™t match that regex ^^) (re @lucaswerkmeister: if I couldnā€™t use mwparserfromhell, I would probably try to do that by replacing .*? (non-greedy in the middle!...) [22:15:02] [telegram] https://tools-static.wmflabs.org/bridgebot/6d4b4fcd/file_14596.jpg [22:15:02] [telegram] yeah, that's a classic šŸ˜ [22:15:04] [telegram] No, it doesn't *have* to be fully regex, alternatives are also welcome (re @lucaswerkmeister: does it absolutely have to be done with a regex? (you know the parse HTML with regex answer, right? ;) )) [22:16:23] [telegram] @Paulo_Darwin what happens if you add `origin=*` to the request URL? usually that tells MediaWiki to treat the request as anonymous (so CORS is allowed), but it might still work with OAuth 2 [22:16:34] [telegram] (and as long as youā€™re only querying userinfo and not trying to make edits, itā€™s safe to try out ^^) [22:19:59] [telegram] it looks the same (still an "opaque" answer) (re @lucaswerkmeister: @Paulo_Darwin what happens if you add origin=* to the request URL? usually that tells MediaWiki to treat the request as anonymou...) [22:20:20] [telegram] hm, then I think Iā€™m out of ideas :/ I hope someone else knows moreā€¦ [22:21:15] [telegram] as a last resource I'll use a "bot login", though I didn't want to giv up on OAuth2 [22:21:29] [telegram] thanks (re @lucaswerkmeister: hm, then I think Iā€™m out of ideas :/ I hope someone else knows moreā€¦) [23:02:29] [telegram] found the solution šŸ˜ when using node.js, we need to add a line with "proxy": "https://commons.wikimedia.org" in package.json (re @lucaswerkmeister: hm, then I think Iā€™m out of ideas :/ I hope someone else knows moreā€¦) [23:02:50] [telegram] o_O [23:02:56] [telegram] Iā€™m confused now, but if it works for you thatā€™s great :D [23:03:21] [telegram] it fools the browser with the cors thing [23:04:02] [telegram] source:https://www.telerik.com/blogs/dealing-with-cors-in-create-react-app [23:04:15] [telegram] (in case it's useful)