Skip to content

Commit

Permalink
unify cdn url
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name authored and alphatownsman committed Apr 7, 2024
1 parent 7b01c85 commit 431d5dc
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 30 deletions.
3 changes: 3 additions & 0 deletions boofilsic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
"site_description": env("NEODB_SITE_DESCRIPTION"),
"site_head": env("NEODB_SITE_HEAD"),
"site_links": [{"title": k, "url": v} for k, v in env("NEODB_SITE_LINKS").items()],
# "cdn_url": "/cdn",
# "cdn_url": "https://cdn.jsdelivr.net",
"cdn_url": "https://fastly.jsdelivr.net",
}

SETUP_ADMIN_USERNAMES = env("NEODB_ADMIN_USERNAMES")
Expand Down
6 changes: 3 additions & 3 deletions catalog/templates/discover.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<meta property="og:site_name" content="{{ site_name }}">
<title>{{ site_name }} - {% trans '发现' %}</title>
{% include "common_libs.html" %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/shikwasa.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/style.min.css"
<script src="{{ cdn_url }}/npm/[email protected]/dist/shikwasa.min.js"></script>
<link href="{{ cdn_url }}/npm/[email protected]/dist/style.min.css"
rel="stylesheet"></link>
<script src="{% static 'js/podcast.js' %}"></script>
</head>
Expand Down Expand Up @@ -101,7 +101,7 @@ <h5>{{ gallery.title }}</h5>
<input type="hidden" name="name" value="discover">
<input type="hidden" name="layout">
</form>
<script src="https://cdn.staticfile.org/html5sortable/0.13.3/html5sortable.min.js"
<script src="{{ cdn_url }}/npm/html5sortable@0.13.3/dist/html5sortable.min.js"
crossorigin="anonymous"></script>
<script src="{% static 'js/sort_layout.js' %}"></script>
{{ layout|json_script:"layout-data" }}
Expand Down
2 changes: 1 addition & 1 deletion catalog/templates/embed_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.staticfile.org/cash/8.1.3/cash.min.js"></script>
<script src="{{ cdn_url }}/npm/cash-dom@8.1.5/dist/cash.min.js"></script>
{% block head %}{% endblock %}
<title>{{ site_name }} - {% trans item.category.label %} | {{ item.title }}</title>
</head>
Expand Down
4 changes: 2 additions & 2 deletions catalog/templates/embed_podcast.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
{% load strip_scheme %}
{% load thumb %}
{% block head %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/shikwasa.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/style.min.css"
<script src="{{ cdn_url }}/npm/[email protected]/dist/shikwasa.min.js"></script>
<link href="{{ cdn_url }}/npm/[email protected]/dist/style.min.css"
rel="stylesheet"></link>
<style>
.shk-player {
Expand Down
4 changes: 2 additions & 2 deletions catalog/templates/podcast.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
{% load strip_scheme %}
{% load thumb %}
{% block head %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/shikwasa.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/style.min.css"
<script src="{{ cdn_url }}/npm/[email protected]/dist/shikwasa.min.js"></script>
<link href="{{ cdn_url }}/npm/[email protected]/dist/style.min.css"
rel="stylesheet"></link>
<script src="{% static 'js/podcast.js' %}"></script>
{% endblock %}
Expand Down
10 changes: 5 additions & 5 deletions common/templates/common_libs.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% if request.user.is_authenticated %}
{% tz_detect %}
{% endif %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cash.min.js"></script>
<script src="{{ cdn_url }}/npm/[email protected]/dist/cash.min.js"></script>
<script type="text/javascript">
if (!$.fn.is_visible) $.fn.is_visible = function () {
return this.filter((_, elt) => (elt.offsetWidth || elt.offsetHeight || elt.getClientRects().length)).length > 0;
Expand All @@ -17,14 +17,14 @@
return this;
};
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].10/dist/htmx.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="{{ cdn_url }}/npm/[email protected].11/dist/htmx.min.js"></script>
<script src="{{ cdn_url }}/npm/[email protected]"></script>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" />
href="{{ cdn_url }}/npm/@picocss/pico@2/css/pico.min.css" />
<link href="{% sass_src 'scss/neodb.scss' %}"
rel="stylesheet"
type="text/css" />
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected].1/css/all.min.css"
<link href="{{ cdn_url }}/npm/@fortawesome/[email protected].2/css/all.min.css"
rel="stylesheet"
type="text/css">
<link rel="search"
Expand Down
8 changes: 2 additions & 6 deletions developer/templates/console.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
<html lang="en">
<head>
<link rel="stylesheet"
href="https://unpkg.com/[email protected]/swagger-ui.css"
crossorigin="anonymous"
referrerpolicy="no-referrer" />
href="{{ cdn_url }}/npm/[email protected]/swagger-ui.min.css">
<title>{{ api.title }} Developer Console</title>
{% include "common_libs.html" %}
<style type="text/css">
Expand Down Expand Up @@ -92,9 +90,7 @@ <h3>
more endpoints can be found in API Documentation below.
</details>
<div id="swagger-ui" data-theme="light"></div>
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js"
crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
<script src="{{ cdn_url }}/npm/[email protected]/swagger-ui-bundle.min.js"></script>
<script>
const ui = SwaggerUIBundle({
url: '{{ openapi_json_url }}',
Expand Down
3 changes: 1 addition & 2 deletions journal/templates/collection_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ site_name }} - 编辑收藏单 - {{ title }}</title>
{% include "common_libs.html" %}
<script src="https://cdn.staticfile.org/html5sortable/0.13.3/html5sortable.min.js"
crossorigin="anonymous"></script>
<script src="{{ cdn_url }}/npm/[email protected]/dist/html5sortable.min.js"></script>
<style type="text/css">
#id_collaborative li, #id_visibility li {display: inline-block !important;}
.grid__main details {
Expand Down
3 changes: 1 addition & 2 deletions journal/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ <h5>
<input type="hidden" name="name" value="profile">
<input type="hidden" name="layout">
</form>
<script src="https://cdn.staticfile.org/html5sortable/0.13.3/html5sortable.min.js"
crossorigin="anonymous"></script>
<script src="{{ cdn_url }}/npm/[email protected]/dist/html5sortable.min.js"></script>
<script src="{% static 'js/sort_layout.js' %}"></script>
{% endif %}
{{ layout|json_script:"layout-data" }}
Expand Down
5 changes: 2 additions & 3 deletions journal/templates/wrapped.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ site_name }} - {{ identity.display_name }} - {{ year }} 年度统计</title>
{% include "common_libs.html" %}
{% comment %} <script src="https://unpkg.com/[email protected]"></script> {% endcomment %}
{% comment %} <script src="{{ cdn_url }}/npm/[email protected]/dist/roughviz.umd.min.js"></script> {% endcomment %}
<script src="{% static 'js/roughviz.umd.js' %}"></script>
{% comment %} <script src="{% static 'js/saveSvgAsPng.js' %}"></script> {% endcomment %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/saveSvgAsPng.min.js"></script>
<script src="{{ cdn_url }}/npm/[email protected]/lib/saveSvgAsPng.min.js"></script>
<style>
.yAxisviz0, .rough-yAxisviz0 {
display: none;
Expand Down
4 changes: 2 additions & 2 deletions social/templates/feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ site_name }} - {% trans '动态' %}</title>
{% include "common_libs.html" %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/shikwasa.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/style.min.css"
<script src="{{ cdn_url }}/npm/[email protected]/dist/shikwasa.min.js"></script>
<link href="{{ cdn_url }}/npm/[email protected]/dist/style.min.css"
rel="stylesheet"></link>
<script src="{% static 'js/podcast.js' %}"></script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions users/templates/users/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<meta property="og:image" content="{{ site_logo }}">
<meta property="og:site_name" content="{{ site_name }}">
<title>{{ site_name }} - {% trans '登录' %}</title>
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected]/dist/autoComplete.min.js"></script>
{% include "common_libs.html" %}
<script src="https://cdn.staticfile.org/js-cookie/3.0.1/js.cookie.min.js"></script>
<script src="{{ cdn_url }}/npm/@tarekraafat/[email protected]/dist/autoComplete.min.js"></script>
<script src="{{ cdn_url }}/npm/[email protected]/dist/js.cookie.min.js"></script>
<script>
$(document).ready(function () {
if (!window.htmx || !window._hyperscript) return; // disable login if cash, htmx or hyperscript not loaded
Expand Down

0 comments on commit 431d5dc

Please sign in to comment.