Permalink
Browse files

www: override info.cern.ch and cernvax.cern.ch to allow for loading d…

…efault.html from proxy server!

proxy serves default.html and rewritten content from pywb, filtering out most headers to avoid breaking browser
add icon for www
pywb: use blank header, /all/ endpoint
app: set default dims to 1024x768, add per-browser override configurable in config.yaml
addresses #20
  • Loading branch information...
1 parent 454a1d4 commit effbc825ee61138d0ce02af757f4b8c164e3e329 @ikreymer ikreymer committed Dec 24, 2015
View
@@ -66,10 +66,12 @@ browsers:
- id: www
name: 'WWW'
os: 'NextSTEP'
- icon: 'firefox.png'
+ icon: 'next-www.png'
path: www
version: '1.0'
- about: ''
+ about: 'https://en.wikipedia.org/wiki/WorldWideWeb'
+ req_width: 1120
+ req_height: 856
# mosaic
- id: mosaic
View
@@ -124,6 +124,12 @@ def new_container(self, browser_id, env=None, default_host=None):
if not browser:
browser = self.browser_paths.get(self.default_browser)
+ if browser.get('req_width'):
+ env['SCREEN_WIDTH'] = browser.get('req_width')
+
+ if browser.get('req_height'):
+ env['SCREEN_HEIGHT'] = browser.get('req_height')
+
container = self.cli.create_container(image=self.image_prefix + '/' + browser['id'],
ports=[self.VNC_PORT, self.CMD_PORT],
environment=env,
@@ -94,6 +94,11 @@
line-height: 0;
}
+ #browser-icon {
+ width: 32px;
+ height: 32px;
+ }
+
#browser-text {
line-height: 58px;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -140,7 +140,7 @@ iframe {
/* replay page */
-#page-replay {overflow: hidden;}
+#page-replay {overflow: inherit;}
/* fonts */
@@ -21,6 +21,8 @@ COPY tars.iso.dmg /home/browser/
COPY previous.cfg /home/browser/.previous/previous.cfg
+COPY proxy.py /home/browser/proxy.py
+
COPY run.sh /app/run.sh
RUN sudo chmod a+x /app/run.sh
Git LFS file not shown
View
@@ -0,0 +1,66 @@
+from bottle import request, route, HTTPResponse, run
+from argparse import ArgumentParser
+
+import requests
+
+pywb_prefix = 'localhost'
+proxy_host = '10.0.2.2'
+start_ts = '1990'
+start_url = ''
+
+ALLOWED_HEADERS = ('content-type', 'content-length', 'location', 'date',
+ 'last-modified', 'set-cookie', 'server', 'content-encoding')
+
+@route('/default.html')
+def do_default():
+ return do_proxy(start_ts + '/' + start_url)
+
+
+@route('/all/<url:re:.*>')
+def do_proxy(url):
+ headers = {'User-Agent': request.environ.get('HTTP_USER_AGENT'),
+ 'Host': proxy_host,
+ 'Accept-Encoding': 'identity',
+ }
+
+ r = requests.get(url=pywb_prefix + url, headers=headers,
+ stream=True,
+ allow_redirects=False)
+
+ resp_headers = []
+ for n, v in r.headers.iteritems():
+ if n == 'content-type':
+ v = v.split(';')[0].strip()
+
+ if n.lower() in ALLOWED_HEADERS:
+ resp_headers.append((n, v))
+
+ resp = HTTPResponse(body=r.iter_content(8192),
+ status=str(r.status_code) + ' ' + r.reason,
+ headers=resp_headers)
+
+ return resp
+
+
+if __name__ == "__main__":
+ parser = ArgumentParser('netcapsule http1.0 proxy')
+ parser.add_argument('--pywb-prefix')
+ parser.add_argument('--start-url')
+ parser.add_argument('--start-ts')
+ parser.add_argument('--port', type=int)
+
+ r = parser.parse_args()
+
+ global pywb_prefix
+ pywb_prefix = r.pywb_prefix
+
+ global start_ts
+ start_ts = r.start_ts
+
+ global start_url
+ start_url = r.start_url
+
+ port = r.port or 8081
+
+ run(host='0.0.0.0', port=port)
+
View
@@ -14,5 +14,8 @@ sudo chown browser ./.previous/previous.cfg
#fluxbox -display $DISPLAY -log /tmp/fluxbox.log &
#fvwm -d $DISPLAY &
+PYWB_IP=$(grep netcapsule_pywb_1 /etc/hosts | cut -f 1 | head -n 1)
+sudo python proxy.py --start-url $URL --pywb-prefix http://$PYWB_IP:8080/all/ --start-ts $TS --port 80 &
+
run_browser Previous
View
@@ -59,8 +59,8 @@ app:
- ${RANDOM_URL_LIST}:/app/urls.txt
environment:
- - SCREEN_WIDTH=1120
- - SCREEN_HEIGHT=856
+ - SCREEN_WIDTH=1024
+ - SCREEN_HEIGHT=768
ports:
- 9020:9020
View
@@ -11,7 +11,7 @@ collections:
# Memento Aggregator Collection: Specify paths to Timegate, Timemap
- memento_reconstruct:
+ all:
index_paths:
# for LANL aggregator
#timegate: http://timetravel.mementoweb.org/api/json/
@@ -25,6 +25,8 @@ collections:
wb_handler_class: !!python/name:archivereplayview.MementoHandler
+ head_insert_html: ./templates/blank.html
+
# fallback: live
live:
@@ -55,7 +57,7 @@ proxy_options:
# Select one of these
#use_default_coll: 'single_archive'
- use_default_coll: 'memento_reconstruct'
+ use_default_coll: 'all'
cookie_resolver: ip
use_client_rewrite: false
No changes.

0 comments on commit effbc82

Please sign in to comment.