mirror of https://github.com/vitalif/phantomjs
commit
f2d0a21330
|
@ -64,6 +64,7 @@ class Phantom(QObject):
|
||||||
self.m_defaultPageSettings['loadImages'] = args.load_images
|
self.m_defaultPageSettings['loadImages'] = args.load_images
|
||||||
self.m_defaultPageSettings['loadPlugins'] = args.load_plugins
|
self.m_defaultPageSettings['loadPlugins'] = args.load_plugins
|
||||||
self.m_defaultPageSettings['userAgent'] = self.m_page.userAgent()
|
self.m_defaultPageSettings['userAgent'] = self.m_page.userAgent()
|
||||||
|
self.m_defaultPageSettings['localAccessRemote'] = args.local_access_remote
|
||||||
self.m_page.applySettings(self.m_defaultPageSettings)
|
self.m_page.applySettings(self.m_defaultPageSettings)
|
||||||
|
|
||||||
self.libraryPath = os.path.dirname(os.path.abspath(self.m_scriptFile))
|
self.libraryPath = os.path.dirname(os.path.abspath(self.m_scriptFile))
|
||||||
|
|
|
@ -60,6 +60,7 @@ def parseArgs(args):
|
||||||
args.ignore_ssl_errors = False if args.ignore_ssl_errors == 'no' else True
|
args.ignore_ssl_errors = False if args.ignore_ssl_errors == 'no' else True
|
||||||
args.load_images = True if args.load_images == 'yes' else False
|
args.load_images = True if args.load_images == 'yes' else False
|
||||||
args.load_plugins = False if args.load_plugins == 'no' else True
|
args.load_plugins = False if args.load_plugins == 'no' else True
|
||||||
|
args.local_access_remote = False if args.local_access_remote == 'no' else True
|
||||||
|
|
||||||
if args.proxy:
|
if args.proxy:
|
||||||
item = args.proxy.split(':')
|
item = args.proxy.split(':')
|
||||||
|
|
|
@ -79,6 +79,10 @@ def argParser():
|
||||||
choices=['yes', 'no'],
|
choices=['yes', 'no'],
|
||||||
help='Load all plugins (i.e. Flash, Silverlight, ...) (default: %(default)s)'
|
help='Load all plugins (i.e. Flash, Silverlight, ...) (default: %(default)s)'
|
||||||
)
|
)
|
||||||
|
parser.add_argument('--local-access-remote', default='no',
|
||||||
|
choices=['yes', 'no'],
|
||||||
|
help='Local content can access remote URL (default: %(default)s)'
|
||||||
|
)
|
||||||
parser.add_argument('--proxy', metavar='address:port',
|
parser.add_argument('--proxy', metavar='address:port',
|
||||||
help='Set the network proxy'
|
help='Set the network proxy'
|
||||||
)
|
)
|
||||||
|
|
|
@ -101,6 +101,8 @@ class WebPage(QObject):
|
||||||
self.m_webPage.settings().setAttribute(QWebSettings.OfflineStorageDatabaseEnabled, True)
|
self.m_webPage.settings().setAttribute(QWebSettings.OfflineStorageDatabaseEnabled, True)
|
||||||
self.m_webPage.settings().setOfflineStoragePath(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
|
self.m_webPage.settings().setOfflineStoragePath(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
|
||||||
self.m_webPage.settings().setAttribute(QWebSettings.LocalStorageDatabaseEnabled, True)
|
self.m_webPage.settings().setAttribute(QWebSettings.LocalStorageDatabaseEnabled, True)
|
||||||
|
self.m_webPage.settings().setAttribute(QWebSettings.OfflineWebApplicationCacheEnabled, True)
|
||||||
|
self.m_webPage.settings().setOfflineWebApplicationCachePath(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
|
||||||
self.m_webPage.settings().setAttribute(QWebSettings.FrameFlatteningEnabled, True)
|
self.m_webPage.settings().setAttribute(QWebSettings.FrameFlatteningEnabled, True)
|
||||||
self.m_webPage.settings().setAttribute(QWebSettings.LocalStorageEnabled, True)
|
self.m_webPage.settings().setAttribute(QWebSettings.LocalStorageEnabled, True)
|
||||||
self.m_webPage.settings().setLocalStoragePath(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
|
self.m_webPage.settings().setLocalStoragePath(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
|
||||||
|
@ -117,6 +119,7 @@ class WebPage(QObject):
|
||||||
|
|
||||||
opt.setAttribute(QWebSettings.AutoLoadImages, defaults['loadImages'])
|
opt.setAttribute(QWebSettings.AutoLoadImages, defaults['loadImages'])
|
||||||
opt.setAttribute(QWebSettings.PluginsEnabled, defaults['loadPlugins'])
|
opt.setAttribute(QWebSettings.PluginsEnabled, defaults['loadPlugins'])
|
||||||
|
opt.setAttribute(QWebSettings.LocalContentCanAccessRemoteUrls, defaults['localAccessRemote'])
|
||||||
if 'userAgent' in defaults:
|
if 'userAgent' in defaults:
|
||||||
self.m_webPage.m_userAgent = defaults['userAgent']
|
self.m_webPage.m_userAgent = defaults['userAgent']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue