Browse Source

appcache fonts

pull/5421/head
Ruud 10 years ago
parent
commit
f129e80cde
  1. 31
      couchpotato/__init__.py
  2. 8
      couchpotato/templates/index.html

31
couchpotato/__init__.py

@ -4,6 +4,7 @@ import traceback
from couchpotato.api import api_docs, api_docs_missing, api from couchpotato.api import api_docs, api_docs_missing, api
from couchpotato.core.event import fireEvent from couchpotato.core.event import fireEvent
from couchpotato.core.helpers.encoding import sp
from couchpotato.core.helpers.variable import md5, tryInt from couchpotato.core.helpers.variable import md5, tryInt
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.environment import Env from couchpotato.environment import Env
@ -77,20 +78,32 @@ def manifest(handler):
lines = [ lines = [
'CACHE MANIFEST', 'CACHE MANIFEST',
'', '',
'CACHE:', 'CACHE:'
web_base
] ]
for url in fireEvent('clientscript.get_styles', single = True): if not Env.get('dev'):
lines.append(web_base + url) # CSS
for url in fireEvent('clientscript.get_scripts', single = True): for url in fireEvent('clientscript.get_styles', single = True):
lines.append(web_base + url) lines.append(web_base + url)
lines.append(static_base + 'images/favicon.ico')
# Scripts
for url in fireEvent('clientscript.get_scripts', single = True):
lines.append(web_base + url)
# Favicon
lines.append(static_base + 'images/favicon.ico')
# Fonts
font_folder = sp(os.path.join(Env.get('app_dir'), 'couchpotato', 'static', 'fonts'))
for subfolder, dirs, files in os.walk(font_folder, topdown = False):
for file in files:
if '.woff' in file:
lines.append(static_base + file + ('?%s' % os.path.getmtime(os.path.join(font_folder, file))))
else:
lines.append('# Not caching anything in dev mode')
# End lines
lines.extend(['', lines.extend(['',
'# Resources that require the user to be online.',
'',
'NETWORK: ', 'NETWORK: ',
'*']) '*'])

8
couchpotato/templates/index.html

@ -8,16 +8,16 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="msapplication-tap-highlight" content="no" /> <meta name="msapplication-tap-highlight" content="no" />
<link href="{{ Env.get('static_path') }}images/favicon.ico" rel="icon" type="image/x-icon" />
<link rel="apple-touch-icon" href="{{ Env.get('static_path') }}images/homescreen.png" />
{% for url in fireEvent('clientscript.get_styles', single = True) %} {% for url in fireEvent('clientscript.get_styles', single = True) %}
<link data-url="{{ url }}" rel="stylesheet" href="{{ Env.get('web_base') }}{{ url }}" type="text/css">{% end %} <link data-url="{{ url }}" rel="stylesheet" href="{{ Env.get('web_base') }}{{ url }}" type="text/css">{% end %}
{% for url in fireEvent('clientscript.get_scripts', single = True) %} {% for url in fireEvent('clientscript.get_scripts', single = True) %}
<script type="text/javascript" src="{{ Env.get('web_base') }}{{ url }}"></script>{% end %} <script type="text/javascript" src="{{ Env.get('web_base') }}{{ url }}"></script>{% end %}
<link href="{{ Env.get('static_path') }}images/favicon.ico" rel="icon" type="image/x-icon" />
<link rel="apple-touch-icon" href="{{ Env.get('static_path') }}images/homescreen.png" />
{% if Env.get('dev') %} {% if Env.get('dev') %}
<script src="//localhost:35729/livereload.js?snipver=1"></script> <script src="//localhost:35729/livereload.js?snipver=1" async></script>
{% end %} {% end %}
<script type="text/javascript"> <script type="text/javascript">

Loading…
Cancel
Save