Skip to content

Commit 9d83c74

Browse files
authored
Merge pull request #1 from GenbuProject/develop
Update 0.2.0
2 parents 0f8739b + 1159d1d commit 9d83c74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1991
-804
lines changed

README.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Mastodon Material
22

3+
<img src="docs/res/top.png" alt="mastodon-material">
4+
35
## Language | 言語
46

57
[日本語 (Japanese)](README_ja.md)
@@ -15,7 +17,7 @@ Mastodon Material is the native theme for Mastodon, which based on [Material Des
1517
- [Mastodon](https://github.com/tootsuite/mastodon) v3.1 or above
1618
- [Sass](https://sass-lang.com) 1.25.x
1719

18-
## Installation
20+
## How to install
1921

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

@@ -83,9 +85,11 @@ Mastodon Material is the native theme for Mastodon, which based on [Material Des
8385
media_host ||= host_to_url(ENV['S3_CLOUDFRONT_HOST'])
8486
media_host ||= host_to_url(ENV['S3_HOSTNAME']) if ENV['S3_ENABLED'] == 'true'
8587
media_host ||= assets_host
88+
8689
# custom host
8790
github_host = "https://raw.githubusercontent.com" # GitHub
8891
google_fonts_host = "https://fonts.gstatic.com" # Google Fonts
92+
8993
Rails.application.config.content_security_policy do |p|
9094
p.base_uri :none
9195
p.default_src :none
@@ -98,29 +102,59 @@ Mastodon Material is the native theme for Mastodon, which based on [Material Des
98102
p.manifest_src :self, assets_host
99103
```
100104

105+
Diff
106+
107+
```diff
108+
def host_to_url(str)
109+
"http#{Rails.configuration.x.use_https ? 's' : ''}://#{str}" unless str.blank?
110+
end
111+
base_host = Rails.configuration.x.web_domain
112+
assets_host = Rails.configuration.action_controller.asset_host
113+
assets_host ||= host_to_url(base_host)
114+
media_host = host_to_url(ENV['S3_ALIAS_HOST'])
115+
media_host ||= host_to_url(ENV['S3_CLOUDFRONT_HOST'])
116+
media_host ||= host_to_url(ENV['S3_HOSTNAME']) if ENV['S3_ENABLED'] == 'true'
117+
media_host ||= assets_host
118+
119+
+ # custom host
120+
+ github_host = "https://raw.githubusercontent.com" # GitHub
121+
+ google_fonts_host = "https://fonts.gstatic.com" # Google Fonts
122+
123+
Rails.application.config.content_security_policy do |p|
124+
p.base_uri :none
125+
p.default_src :none
126+
p.frame_ancestors :none
127+
- p.font_src :self, assets_host
128+
+ p.font_src :self, assets_host, github_host, google_fonts_host
129+
p.img_src :self, :https, :data, :blob, assets_host
130+
p.style_src :self, :unsafe_inline, assets_host
131+
p.media_src :self, :https, :data, assets_host
132+
p.frame_src :self, :https
133+
p.manifest_src :self, assets_host
134+
```
135+
101136
## Customization
102137

103138
[Customization Guide](docs/customization_guide.md)
104139

105-
## Stylish/Stylus theme
140+
## Stylus/Stylish theme
106141

107142
You can use our theme on any server by the browser extension, [Stylus](https://add0n.com/stylus.html) or [Stylish](https://userstyles.org/).
108143

109144
- **Build by yourself**
145+
110146
1. Install [Sass](https://sass-lang.com) on your computer. Require version is refered in [Requirement](#Requirement).
111147
2. Clone or download this repository on your computer.
112148
3. If you want to customize, please read [Customization Guide](docs/customization_guide.md).
113149
4. Run [build.bat (Windows)](build/build.bat) or [build.sh (macOS/Linux)](build/build.sh). Results will be output in [build.css](build/build.css).
114150
5. Make a new theme on Stylus or Stylish and copy the code of [build.css](build/build.css) and paste on it. Add your favorite server domain on it and save/enable it.
115-
. **Get it from [Userstyles.org](https://userstyles.org/)**
151+
152+
- **Get it from [Userstyles.org](https://userstyles.org/)**
116153

117154
Work in progress...
118155

119156
## License
120157

121158
This theme and the Stylish/Stylus theme can be used under [AGPL-3.0](LICENSE). [Material Icons font](https://google.github.io/material-design-icons/#icon-font-for-the-web) is available under [Apache license version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html). (This repository does not include Material Icons font.)
122159

123-
## Screenshot
124-
125-
<img src="docs/res/timeline/v1-light.png" alt="material-v1-light" width=50%>
126-
<img src="docs/res/timeline/v2-dark.png" alt="material-v2-dark" width=50%>
160+
[The header image](docs/src/top.png) was made by using [Noto Sans](https://www.google.com/get/noto/#sans-lgc) and [mastodon.privacyfilter.user.styl](https://github.com/eai04191/userscript-graveyard#mastodonprivacyfilteruserstyl).

README_ja.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Mastodon Material
22

3+
<img src="docs/res/top.png" alt="mastodon-material">
4+
35
## 言語 | Language
46

57
[English (英語)](README.md)
@@ -111,11 +113,42 @@ Mastodon Materialは、[Material Design](https://material.io)準拠のMastodon
111113
p.manifest_src :self, assets_host
112114
```
113115

116+
Diff
117+
118+
```diff
119+
def host_to_url(str)
120+
"http#{Rails.configuration.x.use_https ? 's' : ''}://#{str}" unless str.blank?
121+
end
122+
base_host = Rails.configuration.x.web_domain
123+
assets_host = Rails.configuration.action_controller.asset_host
124+
assets_host ||= host_to_url(base_host)
125+
media_host = host_to_url(ENV['S3_ALIAS_HOST'])
126+
media_host ||= host_to_url(ENV['S3_CLOUDFRONT_HOST'])
127+
media_host ||= host_to_url(ENV['S3_HOSTNAME']) if ENV['S3_ENABLED'] == 'true'
128+
media_host ||= assets_host
129+
130+
+ # custom host
131+
+ github_host = "https://raw.githubusercontent.com" # GitHub
132+
+ google_fonts_host = "https://fonts.gstatic.com" # Google Fonts
133+
134+
Rails.application.config.content_security_policy do |p|
135+
p.base_uri :none
136+
p.default_src :none
137+
p.frame_ancestors :none
138+
- p.font_src :self, assets_host
139+
+ p.font_src :self, assets_host, github_host, google_fonts_host
140+
p.img_src :self, :https, :data, :blob, assets_host
141+
p.style_src :self, :unsafe_inline, assets_host
142+
p.media_src :self, :https, :data, assets_host
143+
p.frame_src :self, :https
144+
p.manifest_src :self, assets_host
145+
```
146+
114147
## カスタマイズ
115148

116149
テーマのカスタマイズについては、[カスタマイズガイド](docs/customization_guide_ja.md)をご覧ください。
117150

118-
## Stylish/Stylus版テーマ
151+
## Stylus/Stylishテーマ
119152

120153
任意のサーバーでもこのテーマを利用できるよう、ブラウザ拡張機能の[Stylus](https://add0n.com/stylus.html)や[Stylish](https://userstyles.org/)向けのテーマを公開しています。
121154

@@ -126,15 +159,13 @@ Mastodon Materialは、[Material Design](https://material.io)準拠のMastodon
126159
3. カスタマイズする場合、[カスタマイズガイド](docs/customization_guide_ja.md)を参照してください。
127160
4. [build.bat (Windows)](build/build.bat)または[build.sh (macOS/Linux)](build/build.sh)を実行してください。結果が[build.css](build/build.css)に出力されます。
128161
5. StylusまたはStylishでテーマを新規作成し、[build.css](build/build.css)の内容をコピペします。利用しているサーバーのドメインを追加して、テーマを保存/有効化してください。
129-
. **[Userstyles.org](https://userstyles.org/)から追加する**
162+
163+
- **[Userstyles.org](https://userstyles.org/)から追加する**
130164

131165
準備中です
132166

133167
## ライセンス
134168

135169
このテーマ及びStylish/Stylus版テーマは[AGPL-3.0](LICENSE)に基づいて公開されています。また、Google製[Material Iconsフォント](https://google.github.io/material-design-icons/#icon-font-for-the-web)については、[Apache license version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)で提供されています。(このリポジトリにMaterial Iconsフォントファイルは含まれていません)
136170

137-
## スクリーンショット
138-
139-
<img src="docs/res/timeline/v1-light.png" alt="material-v1-light" width=50%>
140-
<img src="docs/res/timeline/v2-dark.png" alt="material-v2-dark" width=50%>
171+
[ヘッダー画像](docs/src/top.png)は[Noto Sans](https://www.google.com/get/noto/#sans-lgc)と[mastodon.privacyfilter.user.styl](https://github.com/eai04191/userscript-graveyard#mastodonprivacyfilteruserstyl)を使用して作りました。

0 commit comments

Comments
 (0)