mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Fix generation of static error pages in glitch-soc
This commit is contained in:
@@ -285,8 +285,8 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
# glitch-soc addition to handle the multiple flavors
|
||||
def flavoured_vite_typescript_tag(pack_name, **)
|
||||
vite_typescript_tag("#{Themes.instance.flavour(current_flavour)['pack_directory'].delete_prefix('app/javascript/')}/#{pack_name}", **)
|
||||
def flavoured_vite_typescript_tag(pack_name, flavour: nil, **)
|
||||
vite_typescript_tag("#{Themes.instance.flavour(flavour || current_flavour)['pack_directory'].delete_prefix('app/javascript/')}/#{pack_name}", **)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
!!!
|
||||
%html{ lang: I18n.locale, 'data-contrast': 'auto', 'data-color-scheme': 'auto', 'data-user-flavour': current_flavour.parameterize }
|
||||
%html{ lang: I18n.locale, 'data-contrast': 'auto', 'data-color-scheme': 'auto', 'data-user-flavour': Setting.default_settings['flavour'].parameterize }
|
||||
%head
|
||||
%meta{ 'content' => 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type' }/
|
||||
%meta{ charset: 'utf-8' }/
|
||||
@@ -8,9 +8,9 @@
|
||||
= vite_client_tag
|
||||
= vite_react_refresh_tag
|
||||
= vite_polyfills_tag
|
||||
= flavoured_vite_typescript_tag 'theme-selection.ts', crossorigin: 'anonymous', blocking: 'render'
|
||||
= theme_style_tags current_theme
|
||||
= flavoured_vite_typescript_tag 'error.ts', crossorigin: 'anonymous'
|
||||
= flavoured_vite_typescript_tag 'theme-selection.ts', flavour: Setting.default_settings['flavour'], crossorigin: 'anonymous', blocking: 'render'
|
||||
= theme_style_tags [Setting.default_settings['flavour'], Setting.default_settings['skin']]
|
||||
= flavoured_vite_typescript_tag 'error.ts', flavour: Setting.default_settings['flavour'], crossorigin: 'anonymous'
|
||||
%body.error
|
||||
.dialog
|
||||
.dialog__illustration
|
||||
|
||||
@@ -1,27 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
def render_static_page(action, dest:, **opts)
|
||||
html = ApplicationController.render(action, opts)
|
||||
File.write(dest, html)
|
||||
end
|
||||
|
||||
namespace :assets do
|
||||
desc 'Generate static pages'
|
||||
task generate_static_pages: :environment do
|
||||
def render_static_page(action, dest:, **opts)
|
||||
renderer = Class.new(ApplicationController) do
|
||||
def current_user
|
||||
nil
|
||||
end
|
||||
|
||||
def current_flavour
|
||||
Setting.default_settings['flavour']
|
||||
end
|
||||
|
||||
def current_skin
|
||||
Setting.default_settings['skin']
|
||||
end
|
||||
end
|
||||
|
||||
html = renderer.render(action, opts)
|
||||
File.write(dest, html)
|
||||
end
|
||||
|
||||
render_static_page 'errors/500', layout: 'error', dest: Rails.public_path.join('assets', '500.html')
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user