Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
pleroma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
404
Issues
404
List
Boards
Labels
Service Desk
Milestones
Merge Requests
59
Merge Requests
59
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pleroma
pleroma
Commits
638457ba
Commit
638457ba
authored
Oct 11, 2019
by
KokaKiwi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MastoFE: Add PWA manifest.
parent
fd6d05dc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
1 deletion
+85
-1
config/config.exs
config/config.exs
+10
-0
config/description.exs
config/description.exs
+39
-0
lib/pleroma/web/masto_fe_controller.ex
lib/pleroma/web/masto_fe_controller.ex
+6
-0
lib/pleroma/web/router.ex
lib/pleroma/web/router.ex
+6
-0
lib/pleroma/web/templates/masto_fe/index.html.eex
lib/pleroma/web/templates/masto_fe/index.html.eex
+5
-1
lib/pleroma/web/views/masto_fe_view.ex
lib/pleroma/web/views/masto_fe_view.ex
+19
-0
No files found.
config/config.exs
View file @
638457ba
...
...
@@ -322,6 +322,16 @@
],
default_mascot:
:pleroma_fox_tan
config
:pleroma
,
:manifest
,
icons:
[
%{
src:
"/static/logo.png"
,
type:
"image/png"
}
],
theme_color:
"#282c37"
,
background_color:
"#191b22"
config
:pleroma
,
:activitypub
,
unfollow_blocked:
true
,
outgoing_blocks:
true
,
...
...
config/description.exs
View file @
638457ba
...
...
@@ -1098,6 +1098,45 @@
}
]
},
%{
group:
:pleroma
,
key:
:manifest
,
type:
:group
,
description:
"This section describe PWA manifest instance-specific values. Currently this option relate only for MastoFE"
,
children:
[
%{
key:
:icons
,
type:
{
:list
,
:map
},
description:
"Describe the icons of the app"
,
suggestion:
[
%{
src:
"/static/logo.png"
},
%{
src:
"/static/icon.png"
,
type:
"image/png"
},
%{
src:
"/static/icon.ico"
,
sizes:
"72x72 96x96 128x128 256x256"
}
]
},
%{
key:
:theme_color
,
type:
:string
,
description:
"Describe the theme color of the app"
,
suggestions:
[
"#282c37"
,
"mediumpurple"
]
},
%{
key:
:background_color
,
type:
:string
,
description:
"Describe the background color of the app"
,
suggestions:
[
"#191b22"
,
"aliceblue"
]
}
]
},
%{
group:
:pleroma
,
key:
:mrf_simple
,
...
...
lib/pleroma/web/masto_fe_controller.ex
View file @
638457ba
...
...
@@ -34,6 +34,12 @@ def index(%{assigns: %{user: user}} = conn, _params) do
end
end
@doc
"GET /web/manifest.json"
def
manifest
(
conn
,
_params
)
do
conn
|>
render
(
"manifest.json"
)
end
@doc
"PUT /api/web/settings"
def
put_settings
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"data"
=>
settings
}
=
_params
)
do
with
{
:ok
,
_
}
<-
User
.
update_info
(
user
,
&
User
.
Info
.
mastodon_settings_update
(
&1
,
settings
))
do
...
...
lib/pleroma/web/router.ex
View file @
638457ba
...
...
@@ -591,6 +591,12 @@ defmodule Pleroma.Web.Router do
get
(
"/:version"
,
Nodeinfo
.
NodeinfoController
,
:nodeinfo
)
end
scope
"/"
,
Pleroma
.
Web
do
pipe_through
(
:api
)
get
(
"/web/manifest.json"
,
MastoFEController
,
:manifest
)
end
scope
"/"
,
Pleroma
.
Web
do
pipe_through
(
:mastodon_html
)
...
...
lib/pleroma/web/templates/masto_fe/index.html.eex
View file @
638457ba
...
...
@@ -4,9 +4,13 @@
<meta
charset=
'utf-8'
>
<meta
content=
'width=device-width, initial-scale=1'
name=
'viewport'
>
<title>
<%=
Pleroma
.
Config
.
get
([
:instance
,
:name
])
%>
<%=
Config
.
get
([
:instance
,
:name
])
%>
</title>
<link
rel=
"icon"
type=
"image/png"
href=
"/favicon.png"
/>
<link
rel=
"manifest"
type=
"applicaton/manifest+json"
href=
"
<%=
masto_fe_path
(
Pleroma
.
Web
.
Endpoint
,
:manifest
)
%>
"
/>
<meta
name=
"theme-color"
content=
"
<%=
Config
.
get
([
:manifest
,
:theme_color
])
%>
"
/>
<script
crossorigin=
'anonymous'
src=
"/packs/locales.js"
></script>
<script
crossorigin=
'anonymous'
src=
"/packs/locales/glitch/en.js"
></script>
...
...
lib/pleroma/web/views/masto_fe_view.ex
View file @
638457ba
...
...
@@ -99,4 +99,23 @@ def initial_state(token, user, custom_emojis) do
defp
present?
(
nil
),
do
:
false
defp
present?
(
false
),
do
:
false
defp
present?
(
_
),
do
:
true
def
render
(
"manifest.json"
,
_params
)
do
%{
name:
Config
.
get
([
:instance
,
:name
]),
description:
Config
.
get
([
:instance
,
:description
]),
icons:
Config
.
get
([
:manifest
,
:icons
]),
theme_color:
Config
.
get
([
:manifest
,
:theme_color
]),
background_color:
Config
.
get
([
:manifest
,
:background_color
]),
display:
"standalone"
,
scope:
Pleroma
.
Web
.
base_url
(),
start_url:
masto_fe_path
(
Pleroma
.
Web
.
Endpoint
,
:index
,
[
"getting-started"
]),
categories:
[
"social"
],
serviceworker:
%{
src:
"/sw.js"
}
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment