Name : URIBlock Archive : uribl004.zip MD5-checksum: 0fbcdf7a70454e043b61f54b577809b1 Purpose : URI/URL blocker Version : 0.04 (23-01-2018) Status : Freeware Author : Frank de Bruijn Introduction ~~~~~~~~~~~~ Launching URLs by simply (double) clicking them in applications like Pluto and StrongED can be very convenient. However, if you have a good reason to want this feature switched off you have a problem, because there isn't an easy way to do it. Between programs, launching URLs is usually achieved using Wimp messages. While it is possible to intercept those, doing this selectively - i.e. for certain programs only - can be impossible, depending on which protocol the software involved uses. This little application will try. In its simplest form, it will block all launched URLs, irrespective of where they are coming from or going to. This may be a bit too much, so you can tune it by using a settings file. URIBlock should work with any version of RISC OS from 3.50. However, it has only been tested on 4.39, 5.22 and 5.23. Please let me know if it falls over when you use it with another version of the OS. Installation ~~~~~~~~~~~~ The URIBlock package consists of the application directory !URIBlock with the following files: !Help this file !Run the program starter !RunImage the actual program Settings default settings ShowText a (BASIC) utility to show some text in a small window Copy the !URIBlock application to a suitable place and run it by double clicking. Because of the default Settings file, a small window will briefly appear in the center of your screen with the text 'Blocking is OFF'. If you want URIBlock to start automatically whenever your machine boots, the $.!Boot.Choices.Boot.Tasks directory is the best place to put it. Doing so is recommended, because it may not be sufficient to simply start URIBlock before any target application (e.g. NetSurf). Settings ~~~~~~~~ To keep the program small, I haven't bothered with a graphical user interface. You can set preferences in the settings file. This can be: .URIBlock.Settings .URIBlock .Settings URIBlock will look for these files in the given order and use the first it finds. The default version supplied looks like this: ============================================================================== # URIBlock settings (version 0.04) # Empty lines and lines starting with ; or # are ignored. SysLog:on ShowText:on URIBlock:on URLBlock:on StartBlocked:off Scheme:ftp Scheme:http Scheme:https Block:Pluto Block:StrongED Target:NetSurf IgnoreWWW:on Whitelist: aconet.org* archivemag.co.uk* bbc.co.uk* riscosopen.org* ============================================================================== You can leave the file inside the application directory, but it's probably better to put it in one of the other two locations (i.e. as the file Settings inside the URIBlock subdirectory of Choices or as the file URIBlock in Choices). That way copying a possible new version of !URIBlock over a previous one can never overwrite any changes you may have made to the settings. Keywords ~~~~~~~~ The following keywords are valid in the settings file: SysLog: ShowText: URIBlock: URLBlock: StartBlocked: Scheme: Block: Target: IgnoreWWW: Whitelist: SysLog and ShowText are reporting functions. ShowText:on will make some messages appear on your screen and using SysLog you can check for errors or have a look what was blocked - or not - after the fact. You must have the SysLog module application (see below) running on your machine to use this. If you have used SysLog:on and SysLog isn't running, URIBlock will automatically switch this function off. Before doing so, it will check for a running SysLog for five seconds. This delay is necessary to avoid an unwanted auto-switch-off at boot time - SysLog starts late. The ShowText window will remain on screen for at least two seconds, but may stay open a lot longer if the text - i.e. the URL - is very long. You can close it at any time by clicking anywhere in the window. The URIBlock and URLBlock keywords specify whether the Wimp messages belonging to the Acorn (URI) and ANT (URL) developed protocols should be intercepted. The ANT protocol (InetSuite) is the oldest. It uses Wimp message &4AF80 and provides enough information to block launched URLs from specific applications. The more recent Acorn protocol (AcornURI - message &4E382) unfortunately doesn't pass on anything about which program sent the message. If you use StartBlocked:off, URIBlock will not try to block anything. This can be useful if you put the !URIBlock application in $.Boot.Choices.Boot.Tasks so it is started at boot time, but don't want to switch blocking on until later. Any URI Scheme you mention in the settings file will be caught. Any not mentioned won't. Simple. The Block keyword specifies the sending applications to be blocked. This is only useful if these programs can use the ANT protocol. If you want URIBlock to handle any application that could possibly launch an URL, you do not need the Block keyword. If you use Target, URIBlock will check whether the specified application is running and hasn't been started too early (i.e. before URIBlock). This doesn't always work perfectly, because when an application starts, it may end up in the taskhandle list at an earlier spot than you would expect (e.g. if you have just quit several other applications). That may cause it to end up in the list before URIBlock, in which case any broadcast Wimp message won't reach URIBlock in time. The best way to prevent this is to make sure URIBlock starts very early, like during booting (see 'Installation'). IgnoreWWW and Whitelist are related. The whitelist MUST be the last keyword in the Settings file. Put it on a line by itself and all whitelisted URLs below it - one per line. Make sure there are no leading or trailing spaces and do not include the scheme. If an entry ends in an asterisk, any URL that starts with the bit preceding it will be whitelisted. With IgnoreWWW:on, www.host.tld and host.tld will both be accepted if the whitelist only contains the latter. The keywords are not case sensitive, but you must take care to spell them correctly. If you enter an incorrect keyword before the ShowText or SysLog keywords, the error will not be reported because all options are reset to 'off' before the settings are read. Commands ~~~~~~~~ Once URIBlock is running, you can manipulate it using the URIdispatch command. This is provided by the AcornURI module and actually meant for launching URLs. As we are intercepting those anyway, they are a convenient way to let URIBlock know what we want. The available commands are: URIdispatch UB>:0 switch blocking off URIdispatch UB>:1 switch blocking on URIdispatch UB>:D create two small debug dump files in !URIBlock URIdispatch UB>:L open the log file in an editor URIdispatch UB>:R reload the settings URIdispatch UB>:S open the Settings file in an editor URIdispatch UB>:X quit the application These commands can be used in Obey files. On the command line, you may be able to abbreviate uridispatch to urid. (including the dot, of course). Doing so in Obey files is not advisable. The UB>: bit is a rather contrived 'pseudo URI scheme' which can be in any case. There must not be any spaces between the colon and the command character. Starting a second copy of !URIBlock ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Re-running the application will make the original copy reload its settings. If you've changed them and want the program to pick them up right away, double clicking !URIBlock may be more convenient than entering URIdispatch UB>:R in a taskwindow... Similar functionality is provided by double clicking !URIBlock with the Ctrl or Alt key held down (with Alt, aim for the icon and not the text...). This will do nothing if URIBlock isn't running already, but if it is, it will have the following effect: with Left Ctrl switches blocking on with Left Alt quits the running copy with Left Ctrl and Alt opens the Settings file with Right Alt opens the log file with Right Ctrl switches blocking off The newly started copy will always quit, so you should never have more than one copy of URLBlock trying to intercept messages. My RPCEmu setup doesn't recognise the keycode for the Right Alt key. It's possible this is caused by some peculiarity of my system, but in case it isn't, you can use the Scroll Lock key as alternative Right Alt. AcornURI ~~~~~~~~ URIBlock needs AcornURI and will try to RMRun it when it notices (at start up) that it isn't there. It will look in System:Modules.Network for a file called URI and exit if it doesn't find it. SysLog ~~~~~~ If you want logs, you need the SysLog module. It may be running on your machine already. If it isn't, you can find a copy of the most recent version (0.20) at http://www.compton.nu/software/acorn/syslog.zip . Be very careful with the !SysLog application in that zip! It contains a broken !Boot file which bluntly sets the SysLog variables without checking if they already exist. Copy the application to $.!Boot.Resources and run it there immediately and after that NEVER look inside the zip again, or your logs could end up in there! Loglevel ~~~~~~~~ URIBlock logs warnings and error messages with a specific level. If you leave the SysLog level setting for URIBlock at its default value (100), the log file shouldn't fill up too fast. Setting the level to 120 will add a lot more. If you want the 'Started' message to be logged, you need level 110. Messages with levels above 100 will never be shown on screen (in the ShowText popup). Unexpected blockage ~~~~~~~~~~~~~~~~~~~ Many applications have Web or Website buttons on their menu's Info boxes. Expect them to be blocked as well... To do ~~~~~ * A URIdispatch command to show some status info. * Add a more complete form of wildcarded whitelist entry, i.e. with asterisks preceding as well as trailing. -------------------------- Version 0.01 (08-07-2009) First version. No public release, just for one user. Version 0.02 (11-07-2009) Extensive overhaul. Added Settings file, URIdispatch commands, logging etc. Version 0.03 (19-01-2018) Cleaned up the code. Added whitelist and UB>:S functionality. Thoroughly tested by Martin Avison (thanks, Martin!), which led to: Version 0.04 (23-01-2018) Some bugs fixed. Implementation of the Target function. Improved ShowText. Several additions to the !Help file.