Hostnames in the URL can be blacklisted from running Overdrive functions.
Signed-off-by: Steven Chan <steven3416@gmail.com>
# Define whether a user password is required to complete patron authentication
password_required: 'false' # or 'true'
+
+ # Define a blacklist based on hostname component, eg, abc.domain1 or xyz.domain2
+ blacklisted: ( hn = window.location.hostname, bl = ['abc', 'xyz'] ) ->
+ return unless hn = hn.match(/^(.+?)\./)?[1] # no proper hostname found
+ return unless bl?.length > 0 # no blacklist or is empty
+ return true for v in bl when v is hn # hostname is listed in blacklist
+ return # not listed in blacklist
}
'lodash'
'cookies'
'od_api'
+ 'od_config'
'od_pages_opac'
'od_pages_myopac'
'od_action'
-], ($, _, C, od) ->
+], ($, _, C, od, config) ->
# Indicate the logged in status; the value is determined within document
# ready handler.
return if window.IAMXUL # Comment out to run inside XUL staff client
+ # Do not implement if hostname is blacklisted
+ return if config.blacklisted()
+
# We are logged into EG if indicated by a cookie or if running
# inside XUL staff client.
logged_in = Boolean C('eg_loggedin') or window.IAMXUL