Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redirect old-forum and wiki search results to Pheonix as appropriate.
#1
You know how it goes. Searching for a QB64 solution, search engines return results to the old-forum or old-wiki. Clicking the link only to be informed the server is not found.

With the link returned, you can use part of it to search in either the new-wiki or old-backup forum. This has become very tedious. I thought there must be a better way.

A simple solution is to use Einar Egilsson's Redirector for this. It is a browser add-on for Firefox, Chrome, Edge and Opera. The Redirector allows you to search for a specific URL, substitute it for another URL and force the browser to redirect to this new URL.

How to install redirector on Firefox:

1) Use the following link to get the add-on
https://addons.mozilla.org/en-GB/firefox...edirector/

2) Note: This add-on is not actively monitored for security by Mozilla.
  Check out the "Learn more" link. After reading your choice if you wish to continue.

3) Click the Add to Firefox button.

4) Add Redirector? This extension will have permission to:
  Click Add button

5) Redirector was added.
  Click the check box. Allow this extension to run in Private Windows
  Click Okay button.

6) A redirector symbol is displayed at the top right of the browser confirming it is successfully installed.

Configuring redirector:
Redirect from the old QB64 forum to Phoenix's old-archived read only working forum.

1) Click on the redirector symbol in the drop down click "Edit Redirects" button.
2) On the new browser page that opens, click "Create New Redirect"
3) Fill in the form with the following information:

Configuration information:

        Description:  QB64_forum_old_to_archive
        Example URL:  https://forum.qb64.org/
    Include pattern:  https://forum.qb64.org/*
        Redirect to:  https://qb64forum.alephc.xyz/$1
      Pattern type:  Wildcard click radio buttom
Pattern Description:  Leave blank

Example result: https://qb64forum.alephc.xyz/

To complete it, click the "Save" button.

4) Click  "Create New Redirect"
5) Fill in the form with the following information:

Configuration information:
Redirect from the old QB64 Wiki to Pheonix's new QB64 Wiki.

        Description:  QB64_Wiki_old_to_new
        Example URL:  https://wiki.qb64.org/wiki/
    Include pattern:  https://wiki.qb64.org/wiki/*
        Redirect to:  https://qb64phoenix.com/qb64wiki/index.php/$1
      Pattern type:  Wildcard click radio buttom
Pattern Description:  Leave blank

Example result: https://qb64phoenix.com/qb64wiki/index.php/

To complete it, click the "Save" button.

6) Finally disable the first configuration
"Example redirect, try going to http://example.com/anywordhere"
By clicking the "Disable" button.

Test:
Try the following two links in your browser:

https://forum.qb64.org/index.php?topic=456.0
https://wiki.qb64.org/wiki/$IF


All the best
MPGCAN
Reply
#2
Looks like a useful plugin.

I made my own in QB64...

Code: (Select All)
REM Opens google qb64.rip links in mirror site.
msg$ = "Right click google link and select copy to clipboard."
LOCATE 2, _WIDTH / 2 - LEN(msg$) / 2: PRINT msg$;
LOCATE 4

DO
    _CLIPBOARD$ = ""

    DO
        _LIMIT 10
        IF LEN(_CLIPBOARD$) THEN
            parse$ = MID$(_CLIPBOARD$, INSTR(_CLIPBOARD$, "index"))
            EXIT DO
        END IF
        IF INKEY$ = CHR$(27) THEN SYSTEM
    LOOP

    html$ = "https://qb64forum.alephc.xyz/" + parse$

    SHELL _DONTWAIT "firefox " + html$

    PRINT " Opening: " + html$
LOOP


Pete
Reply
#3
(05-19-2022, 05:21 AM)Pete Wrote: Looks like a useful plugin.
I made my own in QB64...

Very cool!
Not only does it work and is useful, but I never knew QB64 could do that, and learned something knew.
Thanks Pete
Reply
#4
(05-18-2022, 02:37 PM)mpgcan Wrote: A simple solution is to use Einar Egilsson's Redirector for this. It is a browser add-on for Firefox, Chrome, Edge and Opera. The Redirector allows you to search for a specific URL, substitute it for another URL and force the browser to redirect to this new URL.

Thanks for sharing this and explaining how to use it.
This can come in handy for any number of things...
Reply
#5
(05-19-2022, 05:21 AM)Pete Wrote: Looks like a useful plugin.
I made my own in QB64...

I added support for the wiki links, and some options. 
Not as compact and elegant as Pete's code, but it works!

Code: (Select All)
' Opens google qb64.rip links in mirror site.
' http://qb64phoenix.com/forum/showthread.php?tid=429

' DATE         WHO-DONE-IT   DID-WHAT
' 2022-05-18   Pete          Created QB64.org URL redirector.
' 2022-07-22   madscijr      Added options menu and support for wiki.

Const FALSE = 0
Const TRUE = Not FALSE

Dim in$
Dim iCount%: iCount% = 0
Dim oldURL$
Dim parse$
Dim newURL$
Dim bUpdateClipboard%
Dim sOpenBrowser$
Dim sValue$
Dim sMessage$
Dim iPos%

bUpdateClipboard% = TRUE
sOpenBrowser$ = "c"
sMessage$ = ""

Cls
Do
    Cls
    Print "---------------------------------------------------"
    Print "QB64.org link updater by Pete, modified by madscijr"
    Print "Links converted today: " + _Trim$(Str$(iCount%))
    Print "---------------------------------------------------"
    Print "Copy old link to clipboard and press ENTER, or select an option:"
    Print
    If bUpdateClipboard% = TRUE Then sValue$ = "<---" Else sValue$ = ""
    Print "c = copies new link to clipboard......" + sValue$
    If bUpdateClipboard% = FALSE Then sValue$ = "<---" Else sValue$ = ""
    Print "d = do not update clipboard .........." + sValue$
    If sOpenBrowser$ = "g" Then sValue$ = "<---" Else sValue$ = ""
    Print "g = navigates to new link in Chrome..." + sValue$
    If sOpenBrowser$ = "f" Then sValue$ = "<---" Else sValue$ = ""
    Print "f = navigates to new link in Firefox.." + sValue$
    If sOpenBrowser$ <> "g" And sOpenBrowser$ <> "f" Then sValue$ = "<---" Else sValue$ = ""
    Print "n = don't navigate to new link........" + sValue$
    Print "q = quit"

    If Len(sMessage$) > 0 Then
        Print sMessage$
        sMessage$ = ""
    Else
        Print
    End If

    Input "Enter option, or ENTER to convert link and/or navigate"; in$
    in$ = LCase$(_Trim$(in$))
    sMessage$ = Chr$(13)

    If LCase$(_Trim$(in$)) = "c" Then
        bUpdateClipboard% = TRUE
        sMessage$ = sMessage$ + "Clipboard updating: ENABLED" + Chr$(13)
    ElseIf LCase$(_Trim$(in$)) = "d" Then
        bUpdateClipboard% = FALSE
        sMessage$ = sMessage$ + "Clipboard updating: DISABLED" + Chr$(13)
    ElseIf LCase$(_Trim$(in$)) = "g" Then
        sOpenBrowser$ = "g"
        sMessage$ = sMessage$ + "Navigate to new URL: Chrome" + Chr$(13)
    ElseIf LCase$(_Trim$(in$)) = "f" Then
        sOpenBrowser$ = "f"
        sMessage$ = sMessage$ + "Navigate to new URL: Firefox" + Chr$(13)
    ElseIf LCase$(_Trim$(in$)) = "n" Then
        sOpenBrowser$ = "n"
        sMessage$ = sMessage$ + "Navigate to new URL: DISABLED" + Chr$(13)
    ElseIf LCase$(_Trim$(in$)) = "q" Then
        Exit Do
    Else
        If Len(_Clipboard$) Then
            oldURL$ = LCase$(_Clipboard$)

            ' FORUMS:
            ' OLD: https://www.qb64.org/forum/index.php?topic={topic}
            ' NEW: https://qb64forum.alephc.xyz/index.php?topic={topic}

            ' WIKI:
            ' OLD: http://www.qb64.org/wiki/{topic}
            ' NEW: https://qb64phoenix.com/qb64wiki/index.php/{topic}

            If InStr(oldURL$, "/www.qb64.org/forum/index.php") > 0 Then
                ' URL IS FROM FORUMS...
                If InStr(oldURL$, "?topic=") > 0 Then
                    sMessage$ = sMessage$ + "Detected forum link." + Chr$(13)
                    parse$ = Mid$(oldURL$, InStr(oldURL$, "index"))
                    newURL$ = "https://qb64forum.alephc.xyz/" + parse$
                Else
                    sMessage$ = sMessage$ + "Detected forum link, no topic." + Chr$(13)
                    ' GOTO THE ROOT FORUMS URL
                    newURL$ = "https://qb64forum.alephc.xyz/index.php"
                End If
                iCount% = iCount% + 1
            ElseIf InStr(oldURL$, "/www.qb64.org/wiki") > 0 Then
                ' URL IS FROM WIKI...
                If InStr(oldURL$, "/www.qb64.org/wiki/") > 0 Then
                    sMessage$ = sMessage$ + "Detected wiki link." + Chr$(13)
                    iPos% = _InStrRev(oldURL$, "/wiki/")
                    If iPos% > 0 Then
                        parse$ = Right$(oldURL$, Len(oldURL$) - (iPos% + 5))
                    End If
                    newURL$ = "https://qb64phoenix.com/qb64wiki/index.php/" + parse$
                Else
                    sMessage$ = sMessage$ + "Detected wiki link, no topic." + Chr$(13)
                    ' GOTO THE ROOT WIKI URL
                    newURL$ = "https://qb64phoenix.com/qb64wiki/index.php"
                End If
                iCount% = iCount% + 1
            Else
                sMessage$ = sMessage$ + "Link not recognized." + Chr$(13)
                newURL$ = ""
            End If

            If Len(newURL$) > 0 Then
                sMessage$ = sMessage$ + "Converted, new URL is:" + Chr$(13) + newURL$ + Chr$(13)

                If sOpenBrowser$ = "g" Then
                    sMessage$ = sMessage$ + "Opening new link in Chrome." + Chr$(13)
                    Shell _DontWait "chrome " + newURL$
                ElseIf sOpenBrowser$ = "f" Then
                    sMessage$ = sMessage$ + "Opening new link in Firefox." + Chr$(13)
                    Shell _DontWait "firefox " + newURL$
                End If

                If bUpdateClipboard% = TRUE Then
                    sMessage$ = sMessage$ + "Copying new link to clipboard." + Chr$(13)
                    _Clipboard$ = newURL$
                End If
            End If
        Else
            sMessage$ = sMessage$ + "Clipboard is empty!" + Chr$(13)
        End If
    End If
Loop

'System
End
Reply




Users browsing this thread: 2 Guest(s)