• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

GenbuProject/Mastodon-Material: Material Design Native Theme for Mastodon

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

GenbuProject/Mastodon-Material

开源软件地址(OpenSource Url):

https://github.com/GenbuProject/Mastodon-Material

开源编程语言(OpenSource Language):

SCSS 100.0%

开源软件介绍(OpenSource Introduction):

Mastodon Material

Mastodon Material

Language | 言語

日本語 (Japanese)

Overview

Mastodon Material is the native theme for Mastodon, which based on Material Design. Development policy is here (Japanese).

Screenshots

show/hide

v1-light + material-v1 v1-light

v1-dark + material-v1 v1-dark

black + material-v1 black

v2-light + material-v2 v2-light

v2-dark + material-v2 v2-dark

mastodon-light + material-v1 mastodon-light

mastodon-dark + material-v1 mastodon-dark

Requirement

How to install

  1. Copy these files of this repository into app/javascript/styles of Mastodon source directory.

    • /src/mastodon-material/
    • /src/mastodon-material.scss
  2. Add the below code on config/themes.yml

    default: styles/application.scss
    contrast: styles/contrast.scss
    mastodon-light: styles/mastodon-light.scss
    
    # Added theme
    mastodon-material: styles/mastodon-material.scss # add this line
  3. If you want to change the display theme name in your language, add localization strings to config/locales/{lang}.yml like below (At least config/locales/en.yml is REQUIRED)

    themes:
     contrast: High contrast
     default: Mastodon
     mastodon-light: Mastodon (light)
    
     # Added theme
     mastodon-material: Mastodon Material # add this line
  4. If you configure to use the webfont on Google Fonts (default) or on GitHub, you need to add an exception to CSP (Content Security Policy). Make sure to change config/initializers/content_security_policy.rb :

    def host_to_url(str)
     "http#{Rails.configuration.x.use_https ? 's' : ''}://#{str}" unless str.blank?
    end
    base_host = Rails.configuration.x.web_domain
    assets_host = Rails.configuration.action_controller.asset_host
    assets_host ||= host_to_url(base_host)
    media_host = host_to_url(ENV['S3_ALIAS_HOST'])
    media_host ||= host_to_url(ENV['S3_CLOUDFRONT_HOST'])
    media_host ||= host_to_url(ENV['S3_HOSTNAME']) if ENV['S3_ENABLED'] == 'true'
    media_host ||= assets_host
    Rails.application.config.content_security_policy do |p|
     p.base_uri :none
     p.default_src :none
     p.frame_ancestors :none
     p.font_src :self, assets_host
     p.img_src :self, :https, :data, :blob, assets_host
     p.style_src :self, :unsafe_inline, assets_host
     p.media_src :self, :https, :data, assets_host
     p.frame_src :self, :https
     p.manifest_src :self, assets_host

    into

    def host_to_url(str)
     "http#{Rails.configuration.x.use_https ? 's' : ''}://#{str}" unless str.blank?
    end
    base_host = Rails.configuration.x.web_domain
    assets_host = Rails.configuration.action_controller.asset_host
    assets_host ||= host_to_url(base_host)
    media_host = host_to_url(ENV['S3_ALIAS_HOST'])
    media_host ||= host_to_url(ENV['S3_CLOUDFRONT_HOST'])
    media_host ||= host_to_url(ENV['S3_HOSTNAME']) if ENV['S3_ENABLED'] == 'true'
    media_host ||= assets_host
    
    # custom host
    github_host = "https://raw.githubusercontent.com" # GitHub
    google_fonts_host = "https://fonts.gstatic.com" # Google Fonts
    
    Rails.application.config.content_security_policy do |p|
     p.base_uri :none
     p.default_src :none
     p.frame_ancestors :none
     p.font_src :self, assets_host, github_host, google_fonts_host
     p.img_src :self, :https, :data, :blob, assets_host
     p.style_src :self, :unsafe_inline, assets_host
     p.media_src :self, :https, :data, assets_host
     p.frame_src :self, :https
     p.manifest_src :self, assets_host

    Diff

    def host_to_url(str)
     "http#{Rails.configuration.x.use_https ? 's' : ''}://#{str}" unless str.blank?
    end
    base_host = Rails.configuration.x.web_domain
    assets_host = Rails.configuration.action_controller.asset_host
    assets_host ||= host_to_url(base_host)
    media_host = host_to_url(ENV['S3_ALIAS_HOST'])
    media_host ||= host_to_url(ENV['S3_CLOUDFRONT_HOST'])
    media_host ||= host_to_url(ENV['S3_HOSTNAME']) if ENV['S3_ENABLED'] == 'true'
    media_host ||= assets_host
    
    + # custom host
    + github_host = "https://raw.githubusercontent.com" # GitHub
    + google_fonts_host = "https://fonts.gstatic.com" # Google Fonts
    
    Rails.application.config.content_security_policy do |p|
     p.base_uri :none
     p.default_src :none
     p.frame_ancestors :none
    - p.font_src :self, assets_host
    + p.font_src :self, assets_host, github_host, google_fonts_host
     p.img_src :self, :https, :data, :blob, assets_host
     p.style_src :self, :unsafe_inline, assets_host
     p.media_src :self, :https, :data, assets_host
     p.frame_src :self, :https
     p.manifest_src :self, assets_host

Customization

Customization Guide

Stylus/Stylish theme

You can use our theme on any server by the browser extension, Stylus or Stylish.

License

This theme and the Stylish/Stylus theme can be used under AGPL-3.0. Material Icons font is available under Apache license version 2.0. (This repository does not include Material Icons font.)

The header image was made by using Noto Sans and mastodon.privacyfilter.user.styl.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
mbajur/mastodon-tags-explorer: Mastodon tags explorer发布时间:2022-08-17
下一篇:
GenbuHase/MastodonOnEmail: A tool for enjoying Mastodon on Email发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap