]> cat aescling's git repositories - mastodon.git/commitdiff
Add app shortcuts (#15234)
authorMarcin Mikołajczak <me@mkljczk.pl>
Tue, 15 Dec 2020 01:04:56 +0000 (02:04 +0100)
committerGitHub <noreply@github.com>
Tue, 15 Dec 2020 01:04:56 +0000 (02:04 +0100)
* Add app shortcuts

Signed-off-by: mkljczk <me@mkljczk.pl>
* Fix codeclimate issues

Signed-off-by: mkljczk <me@mkljczk.pl>
* Change shortcuts

Signed-off-by: mkljczk <me@mkljczk.pl>
* More consistent new-status icon

Signed-off-by: mkljczk <me@mkljczk.pl>
app/serializers/manifest_serializer.rb
public/shortcuts/direct.png [new file with mode: 0644]
public/shortcuts/new-status.png [new file with mode: 0644]
public/shortcuts/notifications.png [new file with mode: 0644]
public/shortcuts/profile.png [new file with mode: 0644]

index 21ec0d4bed2f96f38b9ec58f1f6dc4950a6413fc..dafe8f55b9e8e42f32e07bc92f421f44370832f6 100644 (file)
@@ -7,7 +7,7 @@ class ManifestSerializer < ActiveModel::Serializer
   attributes :name, :short_name, :description,
              :icons, :theme_color, :background_color,
              :display, :start_url, :scope,
-             :share_target
+             :share_target, :shortcuts
 
   def name
     object.site_title
@@ -64,4 +64,42 @@ class ManifestSerializer < ActiveModel::Serializer
       },
     }
   end
+
+  def shortcuts
+    [
+      {
+        name: 'New toot',
+        url: '/web/statuses/new',
+        icons: [
+          {
+            src: '/shortcuts/new-status.png',
+            type: 'image/png',
+            sizes: '192x192',
+          },
+        ],
+      },
+      {
+        name: 'Notifications',
+        url: '/web/notifications',
+        icons: [
+          {
+            src: '/shortcuts/notifications.png',
+            type: 'image/png',
+            sizes: '192x192',
+          },
+        ],
+      },
+      {
+        name: 'Direct messages',
+        url: '/web/timelines/direct',
+        icons: [
+          {
+            src: '/shortcuts/direct.png',
+            type: 'image/png',
+            sizes: '192x192',
+          },
+        ],
+      },
+    ]
+  end
 end
diff --git a/public/shortcuts/direct.png b/public/shortcuts/direct.png
new file mode 100644 (file)
index 0000000..e8772c0
Binary files /dev/null and b/public/shortcuts/direct.png differ
diff --git a/public/shortcuts/new-status.png b/public/shortcuts/new-status.png
new file mode 100644 (file)
index 0000000..b7095f3
Binary files /dev/null and b/public/shortcuts/new-status.png differ
diff --git a/public/shortcuts/notifications.png b/public/shortcuts/notifications.png
new file mode 100644 (file)
index 0000000..6b9d457
Binary files /dev/null and b/public/shortcuts/notifications.png differ
diff --git a/public/shortcuts/profile.png b/public/shortcuts/profile.png
new file mode 100644 (file)
index 0000000..0b3bf51
Binary files /dev/null and b/public/shortcuts/profile.png differ