Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninstall? #1

Closed
pedro-mass opened this issue Nov 21, 2018 · 16 comments
Closed

Uninstall? #1

pedro-mass opened this issue Nov 21, 2018 · 16 comments

Comments

@pedro-mass
Copy link

So I installed it on 1 profile on my mac: worked flawlessly

Installed it on my 2nd profile, broken.

Okay, switch to 1st profile: broke too.

How can I uninstall this to reset to a clean state?

I'm guessing it installs in a common space, and double installs was a no-no?

@mykeels
Copy link
Owner

mykeels commented Nov 21, 2018

Hey Pedro,

I'm checking out double installs right now.

In the meantime, could you provide the contents of your Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js file?

@mykeels
Copy link
Owner

mykeels commented Nov 21, 2018

Also, what does broken mean?

@pedro-mass
Copy link
Author

It was saying something like: backup not found or something.

I fixed it somehow though. Did a re-install.

@pedro-mass
Copy link
Author

Yeah...what's the best way to uninstall?
I'm having issues again and rather go back to the base

@mykeels
Copy link
Owner

mykeels commented Nov 29, 2018

There's an uninstall command:

slack-theme uninstall

You'll have to get the latest to do that though.

@pedro-mass
Copy link
Author

so...re-run the install script?
Then do the uninstall
Then I can re-run the install script to have a clean starting point?

@mykeels
Copy link
Owner

mykeels commented Nov 29, 2018

Yes, try that

@mykeels
Copy link
Owner

mykeels commented Dec 5, 2018

Did it work? @pedro-mass

@pedro-mass
Copy link
Author

Yup, the uninstall worked in removing the files and the line in my profile.

Slack is still stuck in the non-normal color though. Is there a fix for that?

@pedro-mass
Copy link
Author

Yeah, I still get this in my other profile (same machine)

image

contents of /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js:

/**
 * The preload script needs to stay in regular ole JavaScript, because it is
 * the point of entry for electron-compile.
 */

const allowedChildWindowEventMethod = [
  'windowWithTokenBeganLoading',
  'windowWithTokenFinishedLoading',
  'windowWithTokenCrashed',
  'windowWithTokenDidChangeGeometry',
  'windowWithTokenBecameKey',
  'windowWithTokenResignedKey',
  'windowWithTokenWillClose'
];

if (window.location.href !== 'about:blank') {
  const preloadStartTime = process.hrtime();

  require('./assign-metadata').assignMetadata();
  if (window.parentWebContentsId) {
    //tslint:disable-next-line:no-console max-line-length
    const warn = () => console.warn(`Deprecated: direct access to global object 'parentInfo' will be disallowed. 'parentWebContentsId' will be available until new interface is ready.`);
    Object.defineProperty(window, 'parentInfo', {
      get: () => {
        warn();
        return {
          get webContentsId() {
            warn();
            return parentWebContentsId;
          }
        };
      }
    });
  }

  const { ipcRenderer, remote } = require('electron');

  ipcRenderer
    .on('SLACK_NOTIFY_CHILD_WINDOW_EVENT', (event, method, ...args) => {
      try {
        if (!TSSSB || !TSSSB[method]) throw new Error('Webapp is not fully loaded to execute method');
        if (!allowedChildWindowEventMethod.includes(method)) {
          throw new Error('Unsupported method');
        }

        TSSSB[method](...args);
      } catch (error) {
        console.error(`Cannot execute method`, { error, method }); //tslint:disable-line:no-console
      }
    });

  ipcRenderer
    .on('SLACK_REMOTE_DISPATCH_EVENT', (event, data, origin, browserWindowId) => {
      const evt = new Event('message');
      evt.data = JSON.parse(data);
      evt.origin = origin;
      evt.source = {
        postMessage: (message) => {
          if (!desktop || !desktop.window || !desktop.window.postMessage) throw new Error('desktop not ready');
          return desktop.window.postMessage(message, browserWindowId);
        }
      };

      window.dispatchEvent(evt);
      event.sender.send('SLACK_REMOTE_DISPATCH_EVENT');
    });

  const { init } = require('electron-compile');
  const { assignIn } = require('lodash');
  const path = require('path');

  const { isPrebuilt } = require('../utils/process-helpers');

  //tslint:disable-next-line:no-console
  process.on('uncaughtException', (e) => console.error(e));

  /**
   * Patch Node.js globals back in, refer to
   * https://electron.atom.io/docs/api/process/#event-loaded.
   */
  const processRef = window.process;
  process.once('loaded', () => {
    window.process = processRef;
  });

  window.perfTimer.PRELOAD_STARTED = preloadStartTime;

  // Consider "initial team booted" as whether the workspace is the first loaded after Slack launches
  ipcRenderer.once('SLACK_PRQ_TEAM_BOOT_ORDER', (_event, order) => {
    window.perfTimer.isInitialTeamBooted = order === 1;
  });
  ipcRenderer.send('SLACK_PRQ_TEAM_BOOTED'); // Main process will respond SLACK_PRQ_TEAM_BOOT_ORDER

  const resourcePath = path.join(__dirname, '..', '..');
  const mainModule = require.resolve('../ssb/main.ts');
  const isDevMode = loadSettings.devMode && isPrebuilt();

  init(resourcePath, mainModule, !isDevMode);
}

document.addEventListener('DOMContentLoaded', function() {
 $.ajax({
   url: 'https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/variants/aubergine.css',
   success: function(css) {
     let overrides = `
     code { background-color: #535353; color: #85c5ff; } /* Change color: to whatever font color you want */
     .c-mrkdwn__pre, .c-mrkdwn__quote { background: #535353 !important; background-color: #535353 !important; }
     `
     $('<style></style>').appendTo('head').html(css + overrides);
   }
 });
});

@mykeels
Copy link
Owner

mykeels commented Dec 6, 2018

Remove

document.addEventListener('DOMContentLoaded', function() {
 $.ajax({
   url: 'https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/variants/aubergine.css',
   success: function(css) {
     let overrides = `
     code { background-color: #535353; color: #85c5ff; } /* Change color: to whatever font color you want */
     .c-mrkdwn__pre, .c-mrkdwn__quote { background: #535353 !important; background-color: #535353 !important; }
     `
     $('<style></style>').appendTo('head').html(css + overrides);
   }
 });
});

from the ssb-interop.js and restart slack ... that should give you the default slack theme again. Sorry about the inconvenience. I hope to work on a fix that works across user accounts.

@mykeels
Copy link
Owner

mykeels commented Dec 6, 2018

I also noticed your shell config is saved in ~/.profile-local and not ~/.bash_profile as the script expects.

@pedro-mass
Copy link
Author

pedro-mass commented Dec 6, 2018

yeah, I use a zsh shell and have a profile workflow setup to separate my work vs personal, and different users.

Does it have to be in .bash_profile?

@mykeels
Copy link
Owner

mykeels commented Dec 14, 2018

Right now, yes.

We could add a way to pass the path to a custom profile file to the script. Would that help?

@pedro-mass
Copy link
Author

Can't say no to custom configs 😃

@chaotic-stump
Copy link

Was hitting this same problem on a standard Mac (no ZSH). taking out the DOMContentLoaded section and reinstalling fixed it. Awesome script @mykeels!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants