mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-09 22:23:35 +00:00
Allow disabling short URLs with noshorturls.txt file
This commit is contained in:
@ -521,6 +521,7 @@ def SetGlobalVariables():
|
||||
'allcache.txt',
|
||||
filePresentValue=False,
|
||||
fileAbsentValue=True)
|
||||
_getOldSignalFile(GC_NO_SHORT_URLS, 'noshorturls.txt')
|
||||
_getOldSignalFile(GC_NO_UPDATE_CHECK, 'noupdatecheck.txt')
|
||||
# Assign directories first
|
||||
for itemName in GC_VAR_INFO:
|
||||
|
@ -320,6 +320,8 @@ URL_SHORTENER_ENDPOINT = 'https://gam-shortn.appspot.com/create'
|
||||
|
||||
|
||||
def shorten_url(long_url, httpc=None):
|
||||
if GC_Defaults[GC_NO_SHORT_URLS]:
|
||||
return long_url
|
||||
if not httpc:
|
||||
httpc = transport.create_http(timeout=10)
|
||||
headers = {'Content-Type': 'application/json', 'User-Agent': GAM_INFO}
|
||||
|
@ -1140,6 +1140,8 @@ GC_NO_BROWSER = 'no_browser'
|
||||
GC_OAUTH_BROWSER = 'oauth_browser'
|
||||
# Disable GAM API caching
|
||||
GC_NO_CACHE = 'no_cache'
|
||||
# Disable Short URLs
|
||||
GC_NO_SHORT_URLS = 'no_short_urls'
|
||||
# Disable GAM update check
|
||||
GC_NO_UPDATE_CHECK = 'no_update_check'
|
||||
# Number of threads for gam batch
|
||||
@ -1185,6 +1187,7 @@ GC_Defaults = {
|
||||
GC_DRIVE_DIR: '',
|
||||
GC_NO_BROWSER: False,
|
||||
GC_NO_CACHE: False,
|
||||
GC_NO_SHORT_URLS: False,
|
||||
GC_NO_UPDATE_CHECK: False,
|
||||
GC_NUM_THREADS: 25,
|
||||
GC_OAUTH_BROWSER: False,
|
||||
@ -1264,6 +1267,9 @@ GC_VAR_INFO = {
|
||||
GC_NO_CACHE: {
|
||||
GC_VAR_TYPE: GC_TYPE_BOOLEAN
|
||||
},
|
||||
GC_NO_SHORT_URLS: {
|
||||
GC_VAR_TYPE: GC_TYPE_BOOLEAN
|
||||
},
|
||||
GC_NO_UPDATE_CHECK: {
|
||||
GC_VAR_TYPE: GC_TYPE_BOOLEAN
|
||||
},
|
||||
|
Reference in New Issue
Block a user