diff --git a/config-example.json b/config-example.json index 53ebe0a..6166a87 100644 --- a/config-example.json +++ b/config-example.json @@ -114,5 +114,9 @@ "email_jwt_secret": "@EMAIL_JWT_SECRET@", "google_analytics": "UA-XXXXXXXX-X", "cdnjs_url": "https://cdnjs.loli.net/ajax/libs", - "google_fonts_url": "https://fonts.loli.net" + "self_cdn_url": "", + "google_fonts": { + "type": "like-google-fonts", + "url": "https://fonts.loli.net" + } } diff --git a/static/mathjax.css b/static/self/mathjax.css similarity index 100% rename from static/mathjax.css rename to static/self/mathjax.css diff --git a/static/script.js b/static/self/script.js similarity index 100% rename from static/script.js rename to static/self/script.js diff --git a/static/style.css b/static/self/style.css similarity index 100% rename from static/style.css rename to static/self/style.css diff --git a/static/syzoj.svg b/static/self/syzoj.svg similarity index 100% rename from static/syzoj.svg rename to static/self/syzoj.svg diff --git a/static/tomorrow.css b/static/self/tomorrow.css similarity index 100% rename from static/tomorrow.css rename to static/self/tomorrow.css diff --git a/views/footer.ejs b/views/footer.ejs index 99fe28f..8b70b7e 100644 --- a/views/footer.ejs +++ b/views/footer.ejs @@ -7,6 +7,6 @@ - + diff --git a/views/header.ejs b/views/header.ejs index c026729..5d7acdf 100644 --- a/views/header.ejs +++ b/views/header.ejs @@ -7,21 +7,26 @@ <%= title %> - <%= syzoj.config.title %> - - + + + - - <% if (useLocalLibs || !syzoj.config.google_fonts_url) { %> + <% if (useLocalLibs || !syzoj.config.google_fonts || !syzoj.config.google_fonts.url || !['like-google-fonts', 'like-local'].includes(syzoj.config.google_fonts.type)) { %> + <% } else if (syzoj.config.google_fonts.type === 'like-local') { %> + + + + <% } else { %> - - - - + + + + <% } %> <% if (syzoj.config.google_analytics && syzoj.config.google_analytics !== 'UA-XXXXXXXX-X') { %> diff --git a/views/util.ejs b/views/util.ejs index d1cfe65..ba26610 100644 --- a/views/util.ejs +++ b/views/util.ejs @@ -74,4 +74,12 @@ this.lib = uri => { } } +this.selfLib = uri => { + if (useLocalLibs || !syzoj.config.self_cdn_url) { + return syzoj.utils.makeUrl(['self', uri]); + } else { + return syzoj.config.self_cdn_url + '/' + uri; + } +} + %>