Просмотр исходного кода

Merge pull request #668 from binwiederhier/fix-remove-external-google-font-server-dependency

Fix remove external google font server dependency
Philipp C. Heckel 2 лет назад
Родитель
Сommit
6903e1677d

+ 6 - 0
docs/hooks.py

@@ -0,0 +1,6 @@
+import os
+import shutil
+
+def copy_fonts(config, **kwargs):
+    site_dir = config['site_dir']
+    shutil.copytree('docs/static/fonts', os.path.join(site_dir, 'get'))

+ 1 - 0
docs/releases.md

@@ -11,6 +11,7 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
 **Bug fixes + maintenance:**
 
 * `ntfy sub --poll --from-config` will now include authentication headers from client.yml (if applicable) ([#658](https://github.com/binwiederhier/ntfy/issues/658), thanks to [@wunter8](https://github.com/wunter8))
+* Docs: Removed dependency on Google Fonts in docs ([#554](https://github.com/binwiederhier/ntfy/issues/554), thanks to [@bt90](https://github.com/bt90) for reporting, and [@ozskywalker](https://github.com/ozskywalker) for implementing)
 * Increase allowed auth failure attempts per IP address to 30 (no ticket)
 * Web app: Increase maximum incremental backoff retry interval to 2 minutes (no ticket)
 

+ 56 - 0
docs/static/css/extra.css

@@ -3,6 +3,8 @@
     --md-primary-fg-color--light: #338574;
     --md-primary-fg-color--dark:  #338574;
     --md-footer-bg-color:         #353744;
+    --md-text-font:               "Roboto";
+    --md-code-font:               "Roboto Mono";
 }
 
 .md-header__button.md-logo :is(img, svg) {
@@ -147,3 +149,57 @@ figure video {
 .lightbox .close-lightbox:hover::before {
     background-color: #fff;
 }
+
+/* roboto-300 - latin */
+@font-face {
+    font-display: swap;
+    font-family: 'Roboto';
+    font-style: normal;
+    font-weight: 300;
+    src: url('../fonts/roboto-v30-latin-300.woff2') format('woff2');
+}
+
+/* roboto-regular - latin */
+@font-face {
+    font-display: swap;
+    font-family: 'Roboto';
+    font-style: normal;
+    font-weight: 400;
+    src: url('../fonts/roboto-v30-latin-regular.woff2') format('woff2');
+}
+
+/* roboto-italic - latin */
+@font-face {
+    font-display: swap;
+    font-family: 'Roboto';
+    font-style: italic;
+    font-weight: 400;
+    src: url('../fonts/roboto-v30-latin-italic.woff2') format('woff2');
+}
+
+/* roboto-500 - latin */
+@font-face {
+    font-display: swap;
+    font-family: 'Roboto';
+    font-style: normal;
+    font-weight: 500;
+    src: url('../fonts/roboto-v30-latin-500.woff2') format('woff2');
+}
+
+/* roboto-700 - latin */
+@font-face {
+    font-display: swap;
+    font-family: 'Roboto';
+    font-style: normal;
+    font-weight: 700;
+    src: url('../fonts/roboto-v30-latin-700.woff2') format('woff2');
+}
+
+/* roboto-mono - latin */
+@font-face {
+    font-display: swap;
+    font-family: 'Roboto Mono';
+    font-style: normal;
+    font-weight: 400;
+    src: url('../fonts/roboto-mono-v22-latin-regular.woff2') format('woff2');
+}

BIN
docs/static/fonts/roboto-mono-v22-latin-regular.woff2


BIN
docs/static/fonts/roboto-v30-latin-300.woff2


BIN
docs/static/fonts/roboto-v30-latin-500.woff2


BIN
docs/static/fonts/roboto-v30-latin-700.woff2


BIN
docs/static/fonts/roboto-v30-latin-italic.woff2


BIN
docs/static/fonts/roboto-v30-latin-regular.woff2


+ 4 - 0
mkdocs.yml

@@ -9,6 +9,7 @@ edit_uri: blob/main/docs/
 
 theme:
   name: material
+  font: false
   language: en
   custom_dir: docs/_overrides
   logo: static/img/ntfy.png
@@ -70,6 +71,9 @@ plugins:
   - search
   - minify:
       minify_html: true
+  - mkdocs-simple-hooks:
+      hooks:
+        on_post_build: "docs.hooks:copy_fonts"
 
 nav:
 - "Getting started": index.md

+ 1 - 0
requirements.txt

@@ -1,3 +1,4 @@
 # The documentation uses 'mkdocs', which is written in Python
 mkdocs-material
 mkdocs-minify-plugin
+mkdocs-simple-hooks

+ 4 - 8
web/public/static/css/fonts.css

@@ -6,8 +6,7 @@
     font-style: normal;
     font-weight: 300;
     src: local(''),
-    url('../fonts/roboto-v29-latin-300.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
-    url('../fonts/roboto-v29-latin-300.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+    url('../fonts/roboto-v29-latin-300.woff2') format('woff2');
 }
 
 /* roboto-regular - latin */
@@ -16,8 +15,7 @@
     font-style: normal;
     font-weight: 400;
     src: local(''),
-    url('../fonts/roboto-v29-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
-    url('../fonts/roboto-v29-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+    url('../fonts/roboto-v29-latin-regular.woff2') format('woff2');
 }
 
 /* roboto-500 - latin */
@@ -26,8 +24,7 @@
     font-style: normal;
     font-weight: 500;
     src: local(''),
-    url('../fonts/roboto-v29-latin-500.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
-    url('../fonts/roboto-v29-latin-500.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+    url('../fonts/roboto-v29-latin-500.woff2') format('woff2');
 }
 
 /* roboto-700 - latin */
@@ -36,6 +33,5 @@
     font-style: normal;
     font-weight: 700;
     src: local(''),
-    url('../fonts/roboto-v29-latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
-    url('../fonts/roboto-v29-latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
+    url('../fonts/roboto-v29-latin-700.woff2') format('woff2');
 }

BIN
web/public/static/fonts/roboto-v29-latin-300.woff


BIN
web/public/static/fonts/roboto-v29-latin-500.woff


BIN
web/public/static/fonts/roboto-v29-latin-700.woff


BIN
web/public/static/fonts/roboto-v29-latin-regular.woff