remove consumer stuff: mkt/offline and appcache ... NBD (bug 880767)
This commit is contained in:
Родитель
ab314bc75b
Коммит
efe0f5b591
|
@ -1,43 +0,0 @@
|
|||
@import 'lib';
|
||||
|
||||
body {
|
||||
font-family: "Open Sans", "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
body, h1, h2, h3, h4 {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: $dark-gray;
|
||||
font-size: 26px;
|
||||
line-height: 120%;
|
||||
text-shadow: .5px .5px $white;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.offline {
|
||||
h3 {
|
||||
text-align: center;
|
||||
margin: 2em;
|
||||
}
|
||||
button {
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#site-header h1 {
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
left: auto;
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
if ('applicationCache' in window) {
|
||||
function Log(el) {
|
||||
function ts() {
|
||||
var d = (new Date());
|
||||
function p(v, n) {
|
||||
return ('00' + d['get'+v]()).substr(-n);
|
||||
}
|
||||
return [p('Hours',2), p('Minutes',2),
|
||||
p('Seconds',2), p('Milliseconds',3)].join(':');
|
||||
}
|
||||
this.log = function(msg) {
|
||||
var line = [ts(), msg].join('\t');
|
||||
this.push(line);
|
||||
if (el) {
|
||||
el.innerHTML += line + '\n';
|
||||
}
|
||||
};
|
||||
this.pretty = function() {
|
||||
return this.join('\n');
|
||||
}
|
||||
return this;
|
||||
}
|
||||
Log.prototype = Array.prototype;
|
||||
|
||||
var manny = (function() {
|
||||
var log = new Log(document.getElementById('manny-log')),
|
||||
cache = window.applicationCache,
|
||||
watchInterval = false;
|
||||
|
||||
cache.addEventListener('checking', function() {
|
||||
log.log('checking for updates...');
|
||||
});
|
||||
cache.addEventListener('noupdate', function() {
|
||||
log.log('no updates found.');
|
||||
manny.online = true;
|
||||
});
|
||||
cache.addEventListener('updateready', function() {
|
||||
log.log('successfully updated. refresh to view new content.');
|
||||
if (manny.autoupdate) {
|
||||
log.log('reloading...');
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
cache.addEventListener('downloading', function() {
|
||||
log.log('updating...');
|
||||
manny.online = true;
|
||||
});
|
||||
cache.addEventListener('progress', function(e) {
|
||||
log.log('downloading resources (' + e.loaded + '/' + e.total + ')');
|
||||
});
|
||||
cache.addEventListener('error', function() {
|
||||
log.log('an error occurred.');
|
||||
manny.online = navigator.onLine || false;
|
||||
if (navigator.onLine === false) {
|
||||
log.log('browser is offline.');
|
||||
}
|
||||
});
|
||||
cache.addEventListener('cached', function() {
|
||||
log.log('successfully updated. refresh to view new content.');
|
||||
});
|
||||
|
||||
var manny = {
|
||||
cache: cache,
|
||||
log: log,
|
||||
autoupdate: false,
|
||||
online: true,
|
||||
watch: function(interval) {
|
||||
interval = interval || 30*1000;
|
||||
log.log('polling for new manifest every ' + interval + 'ms');
|
||||
watchInterval = setInterval(function() {
|
||||
cache.update();
|
||||
}, interval);
|
||||
},
|
||||
unwatch: function() {
|
||||
log.log('suspending polling');
|
||||
clearInterval(watchInterval);
|
||||
},
|
||||
size: function() {
|
||||
return cache.mozLength || cache.webkitLength || 0;
|
||||
}
|
||||
};
|
||||
|
||||
return manny;
|
||||
})();
|
||||
}
|
|
@ -111,13 +111,6 @@ CSS = {
|
|||
'css/mkt/lightbox.styl',
|
||||
'css/mkt/filters.styl',
|
||||
),
|
||||
'mkt/offline': (
|
||||
'css/mkt/reset.styl',
|
||||
'css/mkt/site.styl',
|
||||
'css/mkt/header.styl',
|
||||
'css/mkt/buttons.styl',
|
||||
'css/mkt/offline.styl',
|
||||
),
|
||||
'mkt/ecosystem': (
|
||||
'css/devreg/reset.styl',
|
||||
'css/devreg/consumer-typography.styl',
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ LANG }}" dir="{{ DIR }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
{% if not settings.ENGAGE_ROBOTS %}
|
||||
<meta name="robots" content="noindex">
|
||||
{% endif %}
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>{{ _('Firefox Marketplace') }}</title>
|
||||
|
||||
<link rel="shortcut icon" type="image/x-icon"
|
||||
href="{{ MEDIA_URL }}img/mkt/logos/128.png" sizes="128x128">
|
||||
<link rel="shortcut icon" type="image/x-icon"
|
||||
href="{{ MEDIA_URL }}img/mkt/logos/64.png" sizes="64x64">
|
||||
<link rel="shortcut icon" type="image/x-icon"
|
||||
href="{{ MEDIA_URL }}img/mkt/logos/32.png" sizes="32x32">
|
||||
|
||||
{{ css('mkt/offline') }}
|
||||
|
||||
</head>
|
||||
<body class="html-{{ DIR }} {{ CARRIER }} offline">
|
||||
|
||||
<header id="site-header" class="c">
|
||||
<section>
|
||||
<h1>{{ _('Firefox Marketplace') }}</h1>
|
||||
</section>
|
||||
</header>
|
||||
|
||||
<div id="container">
|
||||
<div id="page" role="main"
|
||||
data-context="{{
|
||||
{'type': 'offline',
|
||||
'cache': 'no',
|
||||
'hash': 'offline',
|
||||
'title': _('Firefox Marketplace'),
|
||||
'headertitle': _('Firefox Marketplace'),
|
||||
'bodyclass': 'offline',
|
||||
'parent': '',
|
||||
'category': ''}|json }}">
|
||||
{% block content %}
|
||||
<section class="infobox">
|
||||
<h3>
|
||||
{{ _('Sorry, you need to be online to access the Marketplace.') }}
|
||||
</h3>
|
||||
<div>
|
||||
<button id="reload">{{ _('Try Again') }}</button>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block dbgoverlay %}{% endblock %}
|
||||
|
||||
<script>
|
||||
function reload() {
|
||||
if (navigator.onLine) {
|
||||
window.location = localStorage.from || '/';
|
||||
delete localStorage.from;
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
window.onfocus = window.ononline = reload;
|
||||
document.getElementById('reload').addEventListener('click', reload, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,12 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html {% if settings.USE_APPCACHE %}{{ appcache_manifest_link()|safe }}{% endif %}>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Marketplace Offline Bootstrap</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Marketplace Offline Bootstrap</h1>
|
||||
<pre id="manny-log"></pre>
|
||||
<script src="/media/js/mkt/manny.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,9 +0,0 @@
|
|||
from django.conf.urls import patterns, url
|
||||
|
||||
from . import views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url('^home$', views.home, name='offline.home'),
|
||||
url('^stub$', views.stub, name='offline.stub'),
|
||||
)
|
|
@ -1,10 +0,0 @@
|
|||
import jingo
|
||||
|
||||
from commonware.response.decorators import xframe_allow
|
||||
|
||||
def home(request):
|
||||
return jingo.render(request, 'offline/home.html', {'request': request})
|
||||
|
||||
@xframe_allow
|
||||
def stub(request):
|
||||
return jingo.render(request, 'offline/stub.html', {'request': request})
|
|
@ -54,7 +54,6 @@ INSTALLED_APPS = tuple(INSTALLED_APPS)
|
|||
|
||||
INSTALLED_APPS += (
|
||||
'devhub', # Put here so helpers.py doesn't get loaded first.
|
||||
'django_appcache',
|
||||
'mkt.site',
|
||||
'mkt.account',
|
||||
'mkt.api',
|
||||
|
@ -66,7 +65,6 @@ INSTALLED_APPS += (
|
|||
'mkt.inapp_pay',
|
||||
'mkt.lookup',
|
||||
'mkt.monolith',
|
||||
'mkt.offline',
|
||||
'mkt.purchase',
|
||||
'mkt.ratings',
|
||||
'mkt.receipts',
|
||||
|
@ -214,56 +212,6 @@ BLUEVIA_SECRET = ''
|
|||
BLUEVIA_ORIGIN = 'https://opentel20.tidprojects.com'
|
||||
BLUEVIA_URL = BLUEVIA_ORIGIN + '/en/mozilla/?req='
|
||||
|
||||
# Link to the appcache manifest (activate it) when True.
|
||||
USE_APPCACHE = False
|
||||
|
||||
# These are absolute paths to add to the cache. Wildcards are not allowed here.
|
||||
# These paths will be added as-is to the cache section.
|
||||
APPCACHE_TO_CACHE = [
|
||||
'/offline/home'
|
||||
]
|
||||
|
||||
APPCACHE_NET_PATHS = [
|
||||
'*'
|
||||
]
|
||||
|
||||
APPCACHE_FALLBACK_PATHS = {}
|
||||
|
||||
|
||||
# This callable yields paths relative to MEDIA_ROOT that you want to explicitly
|
||||
# cache. The browser will load *all* of these URLs when your app first loads
|
||||
# so be mindful to only list essential media files. The actual URL of the path
|
||||
# to cache will be determined using MEDIA_URL.
|
||||
# If you use wildcards here the real paths to the file(s) will be
|
||||
# expanded using glob.glob()
|
||||
|
||||
|
||||
def APPCACHE_MEDIA_TO_CACHE():
|
||||
from jingo_minify import helpers
|
||||
bundle = 'mkt/offline'
|
||||
|
||||
# TODO(Kumar) refactor jingo-minify so we don't have to copy/paste this
|
||||
# logic.
|
||||
|
||||
css_build_id = helpers.BUILD_ID_CSS
|
||||
bundle_full = "css:%s" % bundle
|
||||
if bundle_full in helpers.BUNDLE_HASHES:
|
||||
css_build_id = helpers.BUNDLE_HASHES[bundle_full]
|
||||
|
||||
return (
|
||||
'css/%s-min.css?build=%s' % (bundle, css_build_id),
|
||||
)
|
||||
|
||||
|
||||
# Are you working locally? place the following line in your settings_local:
|
||||
# APPCACHE_MEDIA_TO_CACHE = APPCACHE_MEDIA_DEBUG
|
||||
|
||||
def APPCACHE_MEDIA_DEBUG():
|
||||
for f in list(asset_bundles.CSS['mkt/offline']):
|
||||
if f.endswith('.less'):
|
||||
yield f + '.css'
|
||||
else:
|
||||
yield f
|
||||
|
||||
# Allowed `installs_allowed_from` values for manifest validator.
|
||||
VALIDATOR_IAF_URLS = ['https://marketplace.firefox.com']
|
||||
|
|
|
@ -104,20 +104,6 @@ class TestManifest(amo.tests.TestCase):
|
|||
content = json.loads(response.content)
|
||||
eq_(content['name'], 'Mozilla Fruitstand')
|
||||
|
||||
@mock.patch.object(settings, 'USE_APPCACHE', True)
|
||||
def test_manifest_appcache(self):
|
||||
response = self.client.get(self.url)
|
||||
eq_(response.status_code, 200)
|
||||
content = json.loads(response.content)
|
||||
eq_(content['appcache_path'], reverse('django_appcache.manifest'))
|
||||
|
||||
@mock.patch.object(settings, 'USE_APPCACHE', False)
|
||||
def test_manifest_no_appcache(self):
|
||||
response = self.client.get(self.url)
|
||||
eq_(response.status_code, 200)
|
||||
content = json.loads(response.content)
|
||||
assert 'appcache_path' not in content, 'Unexpected: `appcache_path`'
|
||||
|
||||
def test_manifest_orientation(self):
|
||||
response = self.client.get(self.url)
|
||||
eq_(response.status_code, 200)
|
||||
|
|
|
@ -90,8 +90,6 @@ def manifest(request):
|
|||
},
|
||||
'orientation': ['portrait-primary']
|
||||
}
|
||||
if settings.USE_APPCACHE:
|
||||
data['appcache_path'] = reverse('django_appcache.manifest')
|
||||
if get_carrier():
|
||||
data['launch_path'] = urlparams('/', carrier=get_carrier())
|
||||
|
||||
|
|
|
@ -187,12 +187,6 @@
|
|||
{% block overlays %}
|
||||
{% endblock %}
|
||||
|
||||
{% block offline_pixel %}
|
||||
{% if settings.USE_APPCACHE %}
|
||||
<iframe id="offline-pixel" src="{{ url('offline.stub') }}"></iframe>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block dbgoverlay %}{% endblock %}
|
||||
|
||||
{# js #}
|
||||
|
|
|
@ -95,9 +95,6 @@ urlpatterns = patterns('',
|
|||
# Account lookup.
|
||||
('^lookup/', include('mkt.lookup.urls')),
|
||||
|
||||
# Account lookup.
|
||||
('^offline/', include('mkt.offline.urls')),
|
||||
|
||||
# Javascript translations.
|
||||
url('^jsi18n.js$', cache_page(60 * 60 * 24 * 365)(javascript_catalog),
|
||||
{'domain': 'javascript', 'packages': ['zamboni']}, name='jsi18n'),
|
||||
|
|
|
@ -14,7 +14,6 @@ cssutils==0.9.7b3
|
|||
curling==0.2.6
|
||||
Django==1.4.5
|
||||
dj-database-url==0.2.1
|
||||
django_appcache==1.4
|
||||
django-browserid==0.8
|
||||
django-cache-machine==0.6
|
||||
django-celery==3.0.17
|
||||
|
|
|
@ -92,9 +92,6 @@ WEBAPPS_RECEIPT_URL = private_mkt.WEBAPPS_RECEIPT_URL
|
|||
|
||||
APP_PREVIEW = True
|
||||
|
||||
# Use HTML5 offline cache?
|
||||
USE_APPCACHE = False
|
||||
|
||||
WEBAPPS_UNIQUE_BY_DOMAIN = False
|
||||
|
||||
#Bug 744268
|
||||
|
|
Загрузка…
Ссылка в новой задаче