From eeb6ca3f11be5698b87645d22f7d92f571103a34 Mon Sep 17 00:00:00 2001 From: Roland Heyder Date: Tue, 17 Jan 2023 17:58:29 +0100 Subject: [PATCH 1/4] Fix some minor newline issues - just a wrong branch --- source/ide/wiki/wiki_methods.bas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ide/wiki/wiki_methods.bas b/source/ide/wiki/wiki_methods.bas index db1bd2bdb..f6f10815e 100644 --- a/source/ide/wiki/wiki_methods.bas +++ b/source/ide/wiki/wiki_methods.bas @@ -363,9 +363,9 @@ SUB WikiParse (a$) 'Wiki page interpret NEXT 'Wiki specific code handling (no restrictions) - s$ = "__NOEDITSECTION__" + CHR$(10): IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone + s$ = "__NOEDITSECTION__" + CHR$(10): IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDoneKnl s$ = "__NOEDITSECTION__": IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone - s$ = "__NOTOC__" + CHR$(10): IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone + s$ = "__NOTOC__" + CHR$(10): IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDoneKnl s$ = "__NOTOC__": IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone s$ = "": IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone s$ = "": IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone From e2674f01573fbcad89196e14dfc244a483dc2f27 Mon Sep 17 00:00:00 2001 From: Roland Heyder Date: Tue, 17 Jan 2023 18:05:32 +0100 Subject: [PATCH 2/4] Add code to handle Wiki galleries - Availability sections will become icon galleries in the future - as the IDE can't display it as images, we need to substitute it by text --- source/ide/wiki/wiki_methods.bas | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/source/ide/wiki/wiki_methods.bas b/source/ide/wiki/wiki_methods.bas index f6f10815e..7f7c90596 100644 --- a/source/ide/wiki/wiki_methods.bas +++ b/source/ide/wiki/wiki_methods.bas @@ -369,6 +369,39 @@ SUB WikiParse (a$) 'Wiki page interpret s$ = "__NOTOC__": IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone s$ = "": IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone s$ = "": IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone + s$ = ""): v$ = wla$: nl = 1 + IF INSTR(MID$(a$, i, ii - i), "48px") = 0 OR INSTR(MID$(a$, i, ii - i), "nolines") = 0 THEN + i = ii + LEN(wla$) 'ignore this gallery + ELSE + wla$ = StrRemove$(wla$, " "): wla$ = StrRemove$(wla$, CHR$(10)) + wla$ = StrReplace$(wla$, "|'''", "|*"): wla$ = StrReplace$(wla$, "'''", "'' / ") + wla$ = StrReplace$(wla$, "File:Qb64.png|*", "'''QB64;''' ''") + wla$ = StrReplace$(wla$, "File:Qbpe.png|*", "'''QB64-PE;''' ''") + wla$ = StrReplace$(wla$, "File:Win.png|*", "'''Windows;''' ''") + wla$ = StrReplace$(wla$, "File:Lnx.png|*", "'''Linux;''' ''") + wla$ = StrReplace$(wla$, "File:Osx.png|*", "'''macOS;''' ''") + IF INSTR(wla$, ":") > 0 THEN + i = ii + LEN(v$) 'although gallery parameters match, at least + EXIT FOR ' 'one image does not, so ignore this gallery + END IF + wla$ = StrReplace$(wla$, ";", ":") + wla$ = StrReplace$(wla$, "''all''", "''all versions''") + wla$ = "* " + LEFT$(wla$, LEN(wla$) - 3) + CHR$(10) + a$ = LEFT$(a$, ii) + wla$ + MID$(a$, ii + LEN(v$) + 1) + n = LEN(a$): i = ii + END IF + EXIT FOR + END IF + NEXT + GOTO charDoneKnl 'keep nl state for next wiki token + END IF + s$ = "" + CHR$(10): IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDoneKnl + s$ = "": IF c$(LEN(s$)) = s$ THEN i = i + LEN(s$) - 1: GOTO charDone 'Direct HTML code is not handled in Code/Output blocks (hard lock), as all text 'could be part of the code example itself (just imagine a HTML parser/writer demo) From af7dffb88cb376ea26c79fb5189f6ee10b3f4dac Mon Sep 17 00:00:00 2001 From: Roland Heyder Date: Tue, 17 Jan 2023 18:22:28 +0100 Subject: [PATCH 3/4] Local links support improved - former versions did simply link to the top of the referenced page, ignoring the link anchor value (#) - now links can point to any page section heading and the section (if found) is placed in the visible area - to try use the links in the bottom nav section on the alphabetical index --- source/ide/ide_methods.bas | 20 ++++++++++++--- source/ide/wiki/wiki_global.bas | 3 ++- source/ide/wiki/wiki_methods.bas | 44 +++++++++++++++----------------- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index e49176ed9..f16a981ae 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -2495,7 +2495,7 @@ FUNCTION ide2 (ignore) LOOP IF Back_Name$(Help_Back_Pos) = "Alphabetical" OR Back_Name$(Help_Back_Pos) = "By Usage" THEN - IF lnkx1 <> 3 THEN + IF lnkx1 > 3 THEN cx = px + 1 GOTO helpscanrow END IF @@ -2521,6 +2521,10 @@ FUNCTION ide2 (ignore) END IF END IF foundsstr: + IF Help_LinkL THEN + Help_Select = 0: Help_sy = cy - 3 + Help_Search_Str = "": Help_LinkL = 0 + END IF strnotfound: IF KB = KEY_HOME AND KCONTROL THEN @@ -2611,7 +2615,7 @@ FUNCTION ide2 (ignore) IF LEFT$(l$, 5) = "EXTL:" THEN IF (K$ = CHR$(13)) OR (mY = Help_cy - Help_sy + Help_wy1 AND mX = Help_cx - Help_sx + Help_wx1) THEN - l$ = RIGHT$(l$, LEN(l$) - 5) + l$ = MID$(l$, 6) l$ = StrReplace$(l$, " ", "%20") l$ = StrReplace$(l$, "&", "%26") IF INSTR(_OS$, "WIN") = 0 THEN @@ -2630,10 +2634,14 @@ FUNCTION ide2 (ignore) END IF GOTO specialchar ELSEIF LEFT$(l$, 5) = "PAGE:" THEN - l$ = RIGHT$(l$, LEN(l$) - 5) + l$ = MID$(l$, 6) + l2 = INSTR(l$, "#") 'local link? + IF l2 > 0 THEN + Help_Search_Str = StrReplace$(MID$(l$, l2 + 1), "_", " ") + l$ = LEFT$(l$, l2 - 1): Help_LinkL = -1 + END IF IF Back$(Help_Back_Pos) <> l$ THEN Help_Select = 0: Help_MSelect = 0 - 'COLOR 7, 0 Help_Back(Help_Back_Pos).sx = Help_sx 'update position Help_Back(Help_Back_Pos).sy = Help_sy @@ -2672,6 +2680,10 @@ FUNCTION ide2 (ignore) Help_sx = 1: Help_sy = 1: Help_cx = 1: Help_cy = 1 a$ = Wiki$(l$) WikiParse a$ + END IF + IF Help_LinkL THEN + norep = 1: GOTO delsrchagain + ELSE GOTO newpageparsed END IF END IF diff --git a/source/ide/wiki/wiki_global.bas b/source/ide/wiki/wiki_global.bas index b89622cd9..11a231b2d 100644 --- a/source/ide/wiki/wiki_global.bas +++ b/source/ide/wiki/wiki_global.bas @@ -16,9 +16,10 @@ DIM SHARED Help_Pos, Help_Wrap_Pos DIM SHARED Help_Line$ 'index of first txt element of a line DIM SHARED Help_Link$ 'the link info [sep][type:]...[sep] DIM SHARED Help_Link_Sep$: Help_Link_Sep$ = CHR$(13) -DIM SHARED Help_LinkN +DIM SHARED Help_LinkN, Help_LinkL '# of links, local link flag 'Link Types: ' PAGE:wikipagename +' SECT:dummylink (not processed, just to mark page sections as search targets for local links) ' EXTL:external link url DIM SHARED Help_BG_Col DIM SHARED Help_Col_Normal: Help_Col_Normal = 7 diff --git a/source/ide/wiki/wiki_methods.bas b/source/ide/wiki/wiki_methods.bas index 7f7c90596..d012e0c1c 100644 --- a/source/ide/wiki/wiki_methods.bas +++ b/source/ide/wiki/wiki_methods.bas @@ -263,9 +263,9 @@ END FUNCTION SUB WikiParse (a$) 'Wiki page interpret 'Clear info - help_h = 0: help_w = 0: Help_Line$ = "": Help_Link$ = "": Help_LinkN = 0 - Help_Txt$ = SPACE$(1000000) - Help_Txt_Len = 0 + help_h = 0: help_w = 0 + Help_Line$ = "": Help_Txt$ = SPACE$(1000000): Help_Txt_Len = 0 + Help_Link$ = "SECT:dummylink" + Help_Link_Sep$: Help_LinkN = 1 Help_Pos = 1: Help_Wrap_Pos = 0 Help_Line$ = MKL$(1) @@ -286,7 +286,7 @@ SUB WikiParse (a$) 'Wiki page interpret Help_Center = 0: Help_CIndent$ = "" Help_DList = 0: Help_ChkBlank = 0 - link = 0: elink = 0: cb = 0: nl = 1: ah = 0: dl = 0 + link = 0: elink = 0: cb = 0: nl = 1: hl = 0: ah = 0: dl = 0 col = Help_Col @@ -521,8 +521,8 @@ SUB WikiParse (a$) 'Wiki page interpret etext$ = elink$ i2 = INSTR(elink$, " ") IF i2 > 0 THEN - etext$ = RIGHT$(elink$, LEN(elink$) - i2) - elink$ = LEFT$(elink$, i2 - 1) + etext$ = MID$(elink$, i2 + 1) 'text part + elink$ = LEFT$(elink$, i2 - 1) 'link part END IF Help_LinkN = Help_LinkN + 1 @@ -555,17 +555,13 @@ SUB WikiParse (a$) 'Wiki page interpret text$ = link$ i2 = INSTR(link$, "|") 'pipe link? IF i2 > 0 THEN - text$ = RIGHT$(link$, LEN(link$) - i2) 'text part - link$ = LEFT$(link$, i2 - 1) ' 'link part + text$ = MID$(link$, i2 + 1) 'text part + link$ = LEFT$(link$, i2 - 1) 'link part END IF i2 = INSTR(link$, "#") 'local link? IF i2 > 0 THEN - link$ = LEFT$(link$, i2 - 1) 'link to TOP - IF link$ = "" THEN - IF LEFT$(text$, 1) = "#" THEN text$ = MID$(text$, 2) - Help_AddTxt text$, 8, 0 - GOTO charDone - END IF + IF text$ = link$ THEN text$ = MID$(link$, i2 + 1) 'use anchor if no alternate text yet + IF LEFT$(link$, 1) = "#" THEN link$ = Help_PageLoaded$ + link$ 'add current page if missing END IF IF LEFT$(link$, 9) = "Category:" THEN 'ignore category links Help_CheckRemoveBlankLine @@ -663,7 +659,7 @@ SUB WikiParse (a$) 'Wiki page interpret '---------- IF cbo$ <> "" THEN IF RIGHT$(cbo$, 1) = ":" THEN Help_Underline = 2: ELSE Help_Underline = 1 - Help_AddTxt cbo$, Help_Col_Section, 0: ah = 2 + Help_AddTxt cbo$, Help_Col_Section, 1: ah = 2 END IF END IF @@ -824,16 +820,16 @@ SUB WikiParse (a$) 'Wiki page interpret IF Help_LockParse = 0 THEN 'Custom section headings (section color, h3 single underline, h2 double underline) ii = 0 - IF c$(4) = " ===" AND Help_Heading = 3 THEN ii = 3: Help_Heading = 0: ah = 2 - IF c$(3) = "===" AND Help_Heading = 3 THEN ii = 2: Help_Heading = 0: ah = 2 - IF c$(3) = "===" AND nl = 1 THEN ii = 2: Help_CheckBlankLine: Help_Heading = 3 - IF c$(4) = "=== " AND nl = 1 THEN ii = 3: Help_CheckBlankLine: Help_Heading = 3 + IF c$(4) = " ===" AND Help_Heading = 3 THEN ii = 3: Help_Heading = 0: hl = 0: ah = 2 + IF c$(3) = "===" AND Help_Heading = 3 THEN ii = 2: Help_Heading = 0: hl = 0: ah = 2 + IF c$(3) = "===" AND nl = 1 THEN ii = 2: Help_CheckBlankLine: Help_Heading = 3: hl = 1 + IF c$(4) = "=== " AND nl = 1 THEN ii = 3: Help_CheckBlankLine: Help_Heading = 3: hl = 1 IF ii > 0 THEN i = i + ii: col = Help_Col: Help_Underline = 1: GOTO charDone ii = 0 - IF c$(3) = " ==" AND Help_Heading = 2 THEN ii = 2: Help_Heading = 0: ah = 2 - IF c$(2) = "==" AND Help_Heading = 2 THEN ii = 1: Help_Heading = 0: ah = 2 - IF c$(2) = "==" AND nl = 1 THEN ii = 1: Help_CheckBlankLine: Help_Heading = 2 - IF c$(3) = "== " AND nl = 1 THEN ii = 2: Help_CheckBlankLine: Help_Heading = 2 + IF c$(3) = " ==" AND Help_Heading = 2 THEN ii = 2: Help_Heading = 0: hl = 0: ah = 2 + IF c$(2) = "==" AND Help_Heading = 2 THEN ii = 1: Help_Heading = 0: hl = 0: ah = 2 + IF c$(2) = "==" AND nl = 1 THEN ii = 1: Help_CheckBlankLine: Help_Heading = 2: hl = 1 + IF c$(3) = "== " AND nl = 1 THEN ii = 2: Help_CheckBlankLine: Help_Heading = 2: hl = 1 IF ii > 0 THEN i = i + ii: col = Help_Col: Help_Underline = 2: GOTO charDone END IF @@ -987,7 +983,7 @@ SUB WikiParse (a$) 'Wiki page interpret nl = 1 GOTO charDoneKnl 'keep just set nl state END IF - Help_AddTxt CHR$(c), col, 0 + Help_AddTxt CHR$(c), col, hl charDone: nl = 0 From c61757f689dd805aabd501973b7b053d9dee4744 Mon Sep 17 00:00:00 2001 From: Roland Heyder Date: Tue, 17 Jan 2023 18:41:44 +0100 Subject: [PATCH 4/4] Wiki download refactoring - removed the old (commented out) curl stuff - add another note to the error message - simplified the libcurl download loop to use only EOF and not LOF anymore - add a hidden external curl fallback option, read comments from line 1140 for more info --- source/ide/wiki/wiki_methods.bas | 130 ++++++++++++++++--------------- 1 file changed, 67 insertions(+), 63 deletions(-) diff --git a/source/ide/wiki/wiki_methods.bas b/source/ide/wiki/wiki_methods.bas index d012e0c1c..06d92111b 100644 --- a/source/ide/wiki/wiki_methods.bas +++ b/source/ide/wiki/wiki_methods.bas @@ -38,24 +38,6 @@ FUNCTION Wiki$ (PageName$) 'Read cached wiki page (download, if not yet cached) END IF END IF - 'Check for curl - 'IF _SHELLHIDE("curl --version >NUL") <> 0 THEN - ' a$ = CHR$(10) + "{{PageInternalError}}" + CHR$(10) - ' IF PageName$ = "Initialize" THEN - ' a$ = a$ + "To be able to initialize the help system, " - ' ELSEIF PageName$ = "Update All" THEN - ' a$ = a$ + "To be able to update the help pages from the online Wiki, " - ' ELSE - ' a$ = a$ + "The requested help page is not yet cached locally. To download the help page from the online Wiki, " - ' END IF - ' a$ = a$ + "a tool called ''curl'' is required, but it wasn't found on your system." + CHR$(10) + CHR$(10) - ' a$ = a$ + "* To get ''curl'', visit the official [https://curl.se/download.html download page]." + CHR$(10) - ' a$ = a$ + "** Grab the latest ''binary'' archive available for your system." + CHR$(10) - ' a$ = a$ + "** Unpack and drop the ''curl'' executable into the '''qb64pe''' folder." + CHR$(10) - ' a$ = a$ + "** If there's a file named ''curl-ca-bundle.crt'' or similar, drop it into the '''qb64pe''' folder too." + CHR$(10) - ' Wiki$ = a$: EXIT FUNCTION - 'END IF - 'Download message (Status Bar) IF Help_Recaching = 0 THEN a$ = "Downloading '" + PageName$ + "' page..." @@ -68,21 +50,14 @@ FUNCTION Wiki$ (PageName$) 'Read cached wiki page (download, if not yet cached) PCOPY 3, 0 END IF - 'Url query and output arguments for curl - 'url$ = CHR$(34) + wikiBaseAddress$ + "/index.php?title=" + PageName2$ + "&action=edit" + CHR$(34) + 'Url query and output file name url$ = wikiBaseAddress$ + "/index.php?title=" + PageName2$ + "&action=edit" outputFile$ = Cache_Folder$ + "/" + PageName3$ + ".txt" 'Wikitext delimiters s1$ = "name=" + CHR$(34) + "wpTextbox1" + CHR$(34) + ">" s2$ = "" - 'Download page using curl - 'SHELL _HIDE "curl --silent -o " + CHR$(34) + outputFile$ + CHR$(34) + " " + url$ - fh = FREEFILE - 'OPEN outputFile$ FOR BINARY AS #fh 'get new content - 'a$ = SPACE$(LOF(fh)) - 'GET #fh, 1, a$ - 'CLOSE #fh + 'Download page using (lib)curl IF PageName$ = "Initialize" OR PageName$ = "Update All" THEN a$ = "" 'dummy pages (for error display) ELSE @@ -120,19 +95,22 @@ FUNCTION Wiki$ (PageName$) 'Read cached wiki page (download, if not yet cached) '--- wiki redirects & crlf a$ = StrReplace$(a$, "#REDIRECT", "See page") a$ = StrReplace$(a$, CHR$(13) + CHR$(10), CHR$(10)) + IF RIGHT$(a$, 1) <> CHR$(10) THEN a$ = a$ + CHR$(10) '--- put a download date/time entry a$ = "{{QBDLDATE:" + DATE$ + "}}" + CHR$(10) + "{{QBDLTIME:" + TIME$ + "}}" + CHR$(10) + a$ '--- now save it + fh = FREEFILE OPEN outputFile$ FOR OUTPUT AS #fh PRINT #fh, a$; CLOSE #fh ELSE - 'Delete page, if empty or corrupted (force re-download on next access) - 'KILL outputFile$ + 'Error message, if empty or corrupted (force re-download on next access) a$ = CHR$(10) + "{{PageInternalError}}" + CHR$(10) +_ "* Either the requested page is not yet available in the Wiki," + CHR$(10) +_ "* or the download from Wiki failed and corrupted the page data." + CHR$(10) +_ - "** You may try ''Update Current Page'' from the ''Help'' menu." + CHR$(10) + "** You may try ''Update Current Page'' from the ''Help'' menu." + CHR$(10) +_ + ";Note:This may also just be a temporary server issue. If the problem persists " +_ + "after waiting some time, then please feel free to leave us a message." + CHR$(10) END IF Wiki$ = a$ @@ -1120,47 +1098,73 @@ END FUNCTION $UNSTABLE:HTTP FUNCTION wikiDLPage$ (url$, timeout!) -'--- set default result & avoid side effects --- -wikiDLPage$ = "" -wik$ = url$: tio! = timeout! -'--- open client --- -retry: -ch& = _OPENCLIENT(wik$) -IF Help_Recaching < 2 THEN 'avoid messages for 'qb64pe -u' (build time update) - IF ch& = 0 AND LCASE$(LEFT$(wik$, 8)) = "https://" THEN - IF _MESSAGEBOX("QB64-PE Help", "Can't make secure connection (https:) to Wiki, shall the IDE use unsecure (http:) instead?", "yesno", "warning" ) = 1 THEN - IF _MESSAGEBOX("QB64-PE Help", "Do you wanna save your choice permanently for the future?", "yesno", "question" ) = 1 THEN - wikiBaseAddress$ = "http://" + MID$(wikiBaseAddress$, 9) - WriteConfigSetting generalSettingsSection$, "WikiBaseAddress", wikiBaseAddress$ + '--- set default result & avoid side effects --- + wikiDLPage$ = "" + wik$ = url$: tio# = timeout! + '--- request wiki page --- + retry: + ch& = _OPENCLIENT(wik$) + IF Help_Recaching < 2 THEN 'avoid messages for 'qb64pe -u' (build time update) + IF ch& = 0 AND LCASE$(LEFT$(wik$, 8)) = "https://" THEN + IF _SHELLHIDE("curl --version >NUL") <> 0 THEN + 'no external curl available (see notes below) + IF _MESSAGEBOX("QB64-PE Help", "Can't make secure connection (https:) to Wiki, shall the IDE use unsecure (http:) instead?", "yesno", "warning" ) = 1 THEN + IF _MESSAGEBOX("QB64-PE Help", "Do you wanna save your choice permanently for the future?", "yesno", "question" ) = 1 THEN + wikiBaseAddress$ = "http://" + MID$(wikiBaseAddress$, 9) + WriteConfigSetting generalSettingsSection$, "WikiBaseAddress", wikiBaseAddress$ + END IF + wik$ = "http://" + MID$(wik$, 9): GOTO retry + END IF END IF - wik$ = "http://" + MID$(wik$, 9): GOTO retry END IF END IF -END IF -IF ch& = 0 THEN EXIT FUNCTION -'--- wait for response --- -res$ = "": st! = TIMER -DO - _DELAY 0.05 - GET ch&, , rec$ - IF LEN(rec$) > 0 THEN st! = TIMER - res$ = res$ + rec$ + IF ch& = 0 GOTO oneLastChance + '--- read the response --- IF _STATUSCODE(ch&) = 200 THEN - le& = LOF(ch&) - IF le& > -1 THEN - IF LEN(res$) = le& THEN - wikiDLPage$ = res$: EXIT DO - END IF - ELSE + res$ = "": st# = TIMER(0.001) + DO + _DELAY 0.05 + GET ch&, , rec$ + IF LEN(rec$) > 0 THEN st# = TIMER(0.001) + res$ = res$ + rec$ IF EOF(ch&) THEN wikiDLPage$ = res$: EXIT DO END IF - END IF - ELSE - tio! = 0 + IF st# + tio# >= 86400 THEN st# = st# - 86400 + LOOP UNTIL TIMER(0.001) > st# + tio# + END IF + CLOSE ch& + EXIT FUNCTION + '--- try external curl --- + oneLastChance: + 'The external curl tool (if available), together with its local CA + 'bundle is used as a silent fallback option. It's for people on old + 'systems with outdated CA stores. They can use the unsecure http: + 'choice given above for now, but who knows how long http: is still + 'supported by web hosters with today's raising security concerns. + 'Once it isn't supported anymore, those users can then simply drop + 'the external curl & CA bundle into the qb64pe folder as done in + 'former QB64-PE versions, to get secure access again. + ' However, we shouldn't promote this too much in the release notes + 'and instead only give that information to people who complain about + 'not working Wiki downloads in the Forum/Discord. + '--- check for curl --- + IF _SHELLHIDE("curl --version >NUL") = 0 THEN + '--- 1st restore https: protocol, if changed above --- + IF LCASE$(LEFT$(wik$, 7)) = "http://" THEN wik$ = "https://" + MID$(wik$, 8) + '--- issue curl request --- + responseFile$ = Cache_Folder$ + "/curlResponse.txt" + SHELL _HIDE "curl --silent -o " + CHR$(34) + responseFile$ + CHR$(34) + " " + CHR$(34) + wik$ + CHR$(34) + '--- read the response --- + fh = FREEFILE + OPEN responseFile$ FOR BINARY AS #fh + res$ = SPACE$(LOF(fh)) + GET #fh, , res$ + CLOSE #fh + KILL responseFile$ + '--- set result --- + wikiDLPage$ = res$ END IF -LOOP UNTIL TIMER > st! + tio! -CLOSE ch& END FUNCTION FUNCTION wikiLookAhead$ (a$, i, token$) 'Prefetch further wiki text