logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

main.js (1066B)


  1. import * as registerPushNotifications from './actions/push_notifications';
  2. import { default as Mastodon, store } from './containers/mastodon';
  3. import React from 'react';
  4. import ReactDOM from 'react-dom';
  5. import ready from './ready';
  6. const perf = require('./performance');
  7. function main() {
  8. perf.start('main()');
  9. if (window.history && history.replaceState) {
  10. const { pathname, search, hash } = window.location;
  11. const path = pathname + search + hash;
  12. if (!(/^\/web($|\/)/).test(path)) {
  13. history.replaceState(null, document.title, `/web${path}`);
  14. }
  15. }
  16. ready(() => {
  17. const mountNode = document.getElementById('mastodon');
  18. const props = JSON.parse(mountNode.getAttribute('data-props'));
  19. ReactDOM.render(<Mastodon {...props} />, mountNode);
  20. if (process.env.NODE_ENV === 'production') {
  21. // avoid offline in dev mode because it's harder to debug
  22. require('offline-plugin/runtime').install();
  23. store.dispatch(registerPushNotifications.register());
  24. }
  25. perf.stop('main()');
  26. });
  27. }
  28. export default main;