diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..f7048a79bc090f18d557bae104e9cc4f02001d1c
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,23 @@
+image: alpine:latest
+
+before_script:
+ - apk add yarn
+ - yarn global add node-gyp
+ - yarn install
+
+cache:
+ paths:
+ - node_modules
+
+test:
+ script:
+ - yarn run test:jest
+
+build:
+ script:
+ - yarn run build
+ artifacts:
+ paths:
+ - public/packs
+ - public/assets
+ expire_in: 1 week
diff --git a/README.md b/README.md
index 470e379dc0aae2875a0238c99286b3cb5275800b..4a2ca60ae8874a6caf006401265e3912f1112457 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,61 @@
-# Mastodon Glitch Edition #
+# Mastodon Frontend, Glitch-soc + Pleroma Edition
-> Now with automated deploys!
+Here is a distribution of the glitch-soc frontend for pleroma. Everything from the upstream repository is kept and rebased on for easy updates, this does screws up on Merge Requests so they’ll be treated as a patchset if done here.
-[][circleci]
+# Deployement
-[circleci]: https://circleci.com/gh/glitch-soc/mastodon
+This is what you want to do to update the mastofe bundled with pleroma.
-So here's the deal: we all work on this code, and then it runs on dev.glitch.social and anyone who uses that does so absolutely at their own risk. can you dig it?
+- Run ``build.sh`` at the root of this repo, you can set the ``TARGET`` environment variable if pleroma isn’t at ``../pleroma`` (default value of ``TARGET``)
+- Go to pleroma repo:
+ - ``git add priv/static/sw.js priv/static/packs``
+ - ``git commit -m "update mastofe"``
-- You can view documentation for this project at [glitch-soc.github.io/docs/](https://glitch-soc.github.io/docs/).
-- And contributing guidelines are available [here](CONTRIBUTING.md) and [here](https://glitch-soc.github.io/docs/contributing/).
+# Development
+## Branches
+- `pleroma` branch which merges from `rebase/glitch-soc` once it is stable
+- `master`: Same branch as upstream repository
+- `rebase/glitch-soc`: branch which rebases from upstream, used for testing
+
+For developement/Merge Requests I would suggest to use `master` when you are introducing new modifications that cannot be in the upstream, and when you are changing current modifications prefer `rebase/glitch-soc`.
+
+Never use `pleroma` as a base for Merge Requests, it is not meant to be modified directly.
+
+## Tools
+- Node.js
+- yarn (preferred) or npm
+- HTTP proxy (such as nginx)
+
+## nginx setup
+I'll assume that you have already fired up pleroma using the installation guide. To work on the frontend while still having the backend up, use this nginx config.
+
+```
+server {
+ listen 80;
+ server_name pleroma.testing;
+
+ location /packs {
+ add_header 'Access-Control-Allow-Origin' '*';
+ proxy_http_version 1.1;
+ proxy_set_header Host $http_host;
+
+ proxy_pass http://localhost:3035;
+ }
+
+ location / {
+ add_header 'Access-Control-Allow-Origin' '*';
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header Host $http_host;
+
+ proxy_pass http://localhost:4000;
+ }
+}
+```
+
+Change the `server_name` if you like. I personally like to create a new entry in /etc/hosts and add `127.0.0.1 pleroma.testing`, but you do what suits you.
+
+## Running
+- Getting the node dependencies is done with `yarn install -D` (or `npm install` if you don’t have yarn)
+- Launching the frontend is done with `npm run dev`. It should be reachable once it finnishes compiling.
diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js
index ac09adcebd070a5b1151b43a6b3360d923c3e196..3a85d90adaf0aab4290307047c82161cb6b68be9 100644
--- a/app/javascript/flavours/glitch/actions/compose.js
+++ b/app/javascript/flavours/glitch/actions/compose.js
@@ -5,7 +5,6 @@ import { search as emojiSearch } from 'flavours/glitch/util/emoji/emoji_mart_sea
import { useEmoji } from './emojis';
import { tagHistory } from 'flavours/glitch/util/settings';
import { recoverHashtags } from 'flavours/glitch/util/hashtag';
-import resizeImage from 'flavours/glitch/util/resize_image';
import { importFetchedAccounts } from './importer';
import { updateTimeline } from './timelines';
import { showAlertForError } from './alerts';
@@ -46,6 +45,7 @@ export const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE';
export const COMPOSE_SPOILER_TEXT_CHANGE = 'COMPOSE_SPOILER_TEXT_CHANGE';
export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE';
export const COMPOSE_LISTABILITY_CHANGE = 'COMPOSE_LISTABILITY_CHANGE';
+export const COMPOSE_CONTENT_TYPE_CHANGE = 'COMPOSE_CONTENT_TYPE_CHANGE';
export const COMPOSE_EMOJI_INSERT = 'COMPOSE_EMOJI_INSERT';
@@ -74,12 +74,6 @@ export function changeCompose(text) {
};
};
-export function cycleElefriendCompose() {
- return {
- type: COMPOSE_CYCLE_ELEFRIEND,
- };
-};
-
export function replyCompose(status, router) {
return (dispatch, getState) => {
dispatch({
@@ -147,6 +141,7 @@ export function submitCompose(routerHistory) {
}
api(getState).post('/api/v1/statuses', {
status,
+ content_type: getState().getIn(['compose', 'content_type']),
in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
media_ids: media.map(item => item.get('id')),
sensitive: getState().getIn(['compose', 'sensitive']) || (spoilerText.length > 0 && media.size !== 0),
@@ -242,21 +237,42 @@ export function uploadCompose(files) {
dispatch(uploadComposeRequest());
- for (const [i, f] of Array.from(files).entries()) {
- if (media.size + i > 3) break;
-
- resizeImage(f).then(file => {
- const data = new FormData();
- data.append('file', file);
-
- return api(getState).post('/api/v1/media', data, {
- onUploadProgress: function({ loaded }){
- progress[i] = loaded;
- dispatch(uploadComposeProgress(progress.reduce((a, v) => a + v, 0), total));
- },
- }).then(({ data }) => dispatch(uploadComposeSuccess(data)));
- }).catch(error => dispatch(uploadComposeFail(error)));
+ for (const [i, file] of Array.from(files).entries()) {
+ // Looks useless or should reuse uploadLimit
+ // if (media.size + i > 3) break;
+
+ const data = new FormData();
+ data.append('file', file);
+
+ api(getState).post('/api/v1/media', data, {
+ onUploadProgress: function({ loaded }){
+ progress[i] = loaded;
+ dispatch(uploadComposeProgress(progress.reduce((a, v) => a + v, 0), total));
+ },
+ }).then(function (response) {
+ dispatch(uploadComposeSuccess(response.data));
+ }).catch(function (error) {
+ dispatch(uploadComposeFail(error));
+ });
};
+
+ /*
+ * Previous pre-multiple upload code
+ *
+ * a372436a8... Revert: Resize images before upload in web UI to reduce bandwidth
+ *
+ * let data = new FormData();
+ * data.append('file', files[0]);
+ * api(getState).post('/api/v1/media', data, {
+ * onUploadProgress: function (e) {
+ * dispatch(uploadComposeProgress(e.loaded, e.total));
+ * },
+ * }).then(function (response) {
+ * dispatch(uploadComposeSuccess(response.data));
+ * }).catch(function (error) {
+ * dispatch(uploadComposeFail(error));
+ * });
+ */
};
};
@@ -514,6 +530,13 @@ export function changeComposeVisibility(value) {
};
};
+export function changeComposeContentType(value) {
+ return {
+ type: COMPOSE_CONTENT_TYPE_CHANGE,
+ value,
+ };
+};
+
export function insertEmojiCompose(position, emoji) {
return {
type: COMPOSE_EMOJI_INSERT,
diff --git a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js
index 8fdb239f7218e00b353388db2996d7921d55846a..45ca25cde5d479dbe2cefb94f57cd2df995945c1 100644
--- a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js
+++ b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js
@@ -18,7 +18,10 @@ const urlBase64ToUint8Array = (base64String) => {
return outputArray;
};
-const getApplicationServerKey = () => document.querySelector('[name="applicationServerKey"]').getAttribute('content');
+const getApplicationServerKey = () => {
+ const k = document.querySelector('[name="applicationServerKey"]');
+ return k === null ? '' : k.getAttribute('content');
+};
const getRegistration = () => navigator.serviceWorker.ready;
diff --git a/app/javascript/flavours/glitch/components/error_boundary.js b/app/javascript/flavours/glitch/components/error_boundary.js
index 142a0c21a178976957f7be53861ed97e3d6ff85a..d84bd857aabc46bfabc9f93b145f34cbbf031e2c 100644
--- a/app/javascript/flavours/glitch/components/error_boundary.js
+++ b/app/javascript/flavours/glitch/components/error_boundary.js
@@ -55,7 +55,7 @@ export default class ErrorBoundary extends React.PureComponent {
sound
only
{attachment.get('description')}
+ +
-
+