Not working with the Windows 10 Slack App
Spenhouet opened this issue · 15 comments
I'm using the Windows 10 Slack App. It seems I can't install this math-with-slack.
The Slack App installation dir looks very different:
17.11.2017 09:41 <DIR> app
17.11.2017 09:41 237.594 AppxBlockMap.xml
17.11.2017 09:41 2.837 AppxManifest.xml
17.11.2017 09:41 <DIR> AppxMetadata
17.11.2017 09:41 10.550 AppxSignature.p7x
17.11.2017 09:41 <DIR> assets
10.11.2017 16:31 680 BackgroundTask.pri
10.11.2017 16:31 8.704 BackgroundTask.winmd
10.11.2017 16:31 8.192 BackgroundTaskRegisterer.exe
10.11.2017 16:31 125.120 clrcompression.dll
10.11.2017 16:31 1.341 priconfig.xml
10.11.2017 16:31 42.576 resources.pri
10.11.2017 16:31 17.904 resources.scale-200.pri
app dir:
04.12.2017 15:46 19.136 api-ms-win-core-console-l1-1-0.dll
04.12.2017 15:46 18.112 api-ms-win-core-datetime-l1-1-0.dll
04.12.2017 15:46 18.112 api-ms-win-core-debug-l1-1-0.dll
04.12.2017 15:46 18.624 api-ms-win-core-errorhandling-l1-1-0.dll
04.12.2017 15:46 22.208 api-ms-win-core-file-l1-1-0.dll
04.12.2017 15:46 18.624 api-ms-win-core-file-l1-2-0.dll
04.12.2017 15:46 18.624 api-ms-win-core-file-l2-1-0.dll
04.12.2017 15:46 18.616 api-ms-win-core-handle-l1-1-0.dll
04.12.2017 15:46 18.624 api-ms-win-core-heap-l1-1-0.dll
04.12.2017 15:46 18.616 api-ms-win-core-interlocked-l1-1-0.dll
04.12.2017 15:46 19.136 api-ms-win-core-libraryloader-l1-1-0.dll
04.12.2017 15:46 21.184 api-ms-win-core-localization-l1-2-0.dll
04.12.2017 15:46 19.136 api-ms-win-core-memory-l1-1-0.dll
04.12.2017 15:46 18.624 api-ms-win-core-namedpipe-l1-1-0.dll
04.12.2017 15:46 19.648 api-ms-win-core-processenvironment-l1-1-0.dll
04.12.2017 15:46 20.672 api-ms-win-core-processthreads-l1-1-0.dll
04.12.2017 15:46 19.136 api-ms-win-core-processthreads-l1-1-1.dll
04.12.2017 15:46 18.112 api-ms-win-core-profile-l1-1-0.dll
04.12.2017 15:46 18.616 api-ms-win-core-rtlsupport-l1-1-0.dll
04.12.2017 15:46 18.624 api-ms-win-core-string-l1-1-0.dll
04.12.2017 15:46 20.672 api-ms-win-core-synch-l1-1-0.dll
04.12.2017 15:46 19.136 api-ms-win-core-synch-l1-2-0.dll
04.12.2017 15:46 19.648 api-ms-win-core-sysinfo-l1-1-0.dll
04.12.2017 15:46 18.624 api-ms-win-core-timezone-l1-1-0.dll
04.12.2017 15:46 18.624 api-ms-win-core-util-l1-1-0.dll
04.12.2017 15:46 19.648 api-ms-win-crt-conio-l1-1-0.dll
04.12.2017 15:46 22.720 api-ms-win-crt-convert-l1-1-0.dll
04.12.2017 15:46 19.136 api-ms-win-crt-environment-l1-1-0.dll
04.12.2017 15:46 20.672 api-ms-win-crt-filesystem-l1-1-0.dll
04.12.2017 15:46 19.136 api-ms-win-crt-heap-l1-1-0.dll
04.12.2017 15:46 19.136 api-ms-win-crt-locale-l1-1-0.dll
04.12.2017 15:46 27.840 api-ms-win-crt-math-l1-1-0.dll
04.12.2017 15:46 26.296 api-ms-win-crt-multibyte-l1-1-0.dll
04.12.2017 15:46 70.848 api-ms-win-crt-private-l1-1-0.dll
04.12.2017 15:46 19.648 api-ms-win-crt-process-l1-1-0.dll
04.12.2017 15:46 23.232 api-ms-win-crt-runtime-l1-1-0.dll
04.12.2017 15:46 24.768 api-ms-win-crt-stdio-l1-1-0.dll
04.12.2017 15:46 24.768 api-ms-win-crt-string-l1-1-0.dll
04.12.2017 15:46 21.184 api-ms-win-crt-time-l1-1-0.dll
04.12.2017 15:46 19.136 api-ms-win-crt-utility-l1-1-0.dll
04.12.2017 15:46 2.699 AppxManifest.xml
04.12.2017 15:46 24.844 blink_image_resources_200_percent.pak
04.12.2017 15:46 333.632 concrt140.dll
04.12.2017 15:46 15 content_resources_200_percent.pak
04.12.2017 15:46 10.118.484 content_shell.pak
04.12.2017 15:46 4.173.928 d3dcompiler_47.dll
04.12.2017 15:46 2.139.648 ffmpeg.dll
04.12.2017 15:46 10.130.464 icudtl.dat
04.12.2017 15:46 93.184 libEGL.dll
04.12.2017 15:46 2.551.296 libGLESv2.dll
04.12.2017 15:46 1.423.207 LICENSE
04.12.2017 15:46 1.464.999 LICENSES-win32.json
04.12.2017 15:45 <DIR> locales
04.12.2017 15:46 633.152 msvcp140.dll
04.12.2017 15:46 342.741 natives_blob.bin
04.12.2017 15:46 19.127.296 node.dll
04.12.2017 15:46 139.838 pdf_viewer_resources.pak
04.12.2017 15:45 <DIR> resources
04.12.2017 15:46 81.145.344 Slack.exe
04.12.2017 15:46 991.820 snapshot_blob.bin
04.12.2017 15:46 997.056 ucrtbase.dll
04.12.2017 15:46 86.999 ui_resources_200_percent.pak
04.12.2017 15:46 1.578.496 Update.exe
04.12.2017 15:46 395.592 vccorlib140.dll
04.12.2017 15:46 87.888 vcruntime140.dll
04.12.2017 15:46 7 version
04.12.2017 15:46 59.833 views_resources_200_percent.pak
Are you talking about the Slack App that you get from Windows Store? Because the 64-bit installer from slack website works just fine for me with the following index.js
file: (Slack version (2.9.0))
//do not migrate preload script into TypeScript
require('../stat-cache');
const profiler = require('../utils/profiler');
if (profiler.shouldProfile()) profiler.startProfiling();
var startup = function() {
var url = require('url');
// Skip "?loadSettings=".
var fileUri = url.parse(window.location.href);
var queryParts = fileUri.query.split('&');
var loadSettingsStr = null;
for (var j=0; j < queryParts.length; j++) {
if (queryParts[j].match(/loadSettings/)) {
loadSettingsStr = queryParts[j].replace("loadSettings=", "");
break;
}
}
var loadSettings = JSON.parse(decodeURIComponent(loadSettingsStr));
// Require before the module cache in dev mode
window.loadSettings = loadSettings;
var noCommitVersion = loadSettings.version.split('-')[0];
var shouldSuppressErrors = loadSettings.devMode;
if (!loadSettings.isSpec) {
require('../renderer/bugsnag-setup').setupBugsnag(shouldSuppressErrors, noCommitVersion);
}
if (loadSettings.bootstrapScript) {
require(loadSettings.bootstrapScript);
}
};
document.addEventListener("DOMContentLoaded", function() { // eslint-disable-line
try {
startup();
// *** Code injected for MathJax support
// See: https://github.com/fsavje/math-with-slack
var mathjax_inject_script = `
var mathjax_config = document.createElement("script");
mathjax_config.type = "text/x-mathjax-config";
mathjax_config.text = \`
MathJax.Hub.Config({
messageStyle: "none",
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
skipTags: ["script","noscript","style","textarea","pre","code"],
inlineMath: [ ['\$','\$'] ],
displayMath: [ ['\$\$','\$\$'] ],
processEscapes: true
},
TeX: {
extensions: ["noErrors.js", "noUndefined.js"]
}
});
\`;
var mathjax_script = document.createElement("script");
mathjax_script.type = "text/javascript";
mathjax_script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js";
document.getElementsByTagName("head")[0].appendChild(mathjax_config);
document.getElementsByTagName("head")[0].appendChild(mathjax_script);
var render = function (records, observer) {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
};
var target = document.querySelector('#msgs_div');
var observer = new MutationObserver(render);
var config = { attributes: false, childList: true, characterData: true, subtree: true };
observer.observe(target, config);
`;
window.webviews = document.querySelectorAll(".TeamView webview");
setTimeout(function() {
for(var i = 0; i < webviews.length; i++) {
webviews[i].executeJavaScript(mathjax_inject_script);
}
}, 10000);
// *** End injected MathJax
} catch (e) {
console.log(e.stack);
if (window.Bugsnag) {
window.Bugsnag.notifyException(e, "Renderer crash");
}
throw e;
}
});
Can you locate an index.js
somewhere?
@crstnbr I found the index.js
in a sub folder: \app\resources\app.asar.unpacked\src\static\index.js
Do I only need to modify this file? I'm not sure if modifying this file works or would take effect.
It looks like the folder structure is changed for the Windows 10 app.
@Spenhouet Could you please try to run the following and report if it works:
math_with_slack.bat %UserProfile%\AppData\Local\slack\app\resources\app.asar.unpacked\src\static
@fsavje The \app
folder is located in another directory (see command bellow). The slack main folder contains multiple long character strings that look like IDs (therefore I removed them -> marked with <removed>
).
The script found the index.js and said it was installed successfully but actually can't get write access and therefore doesn't install anything (the script was started with admin rights).
math_with_slack.bat "C:\Program Files\WindowsApps\<removed>.Slack_2.9.0.0_x64__<removed>\app\resources\app.asar.unpacked\src\static"
Using Slack installation at: C:\Program Files\WindowsApps\<removed>.Slack_2.9.0.0_x64__<removed>\app\resources\app.asar.unpacked\src\static
Zugriff verweigert
Zugriff verweigert
Zugriff verweigert
Zugriff verweigert
Zugriff verweigert
math-with-slack has been installed. Please restart the Slack client.
Drücken Sie eine beliebige Taste . . .
@Spenhouet Sorry, I forgot to push the changes. They'll be online in a few minute.
The issue here is that Windows Store installs the app in a weird location. To minimize the risk for errors, I decided not to write up a script that searches the hard drive for possible Slack installations. Instead, users who have installed the Windows Store version will thus have to specify Slack's location themselves.
@fsavje Oh I see. Thank you 👍
Did you test it with the Windows Store App?
If no, I could test it when the changes are up.
@Spenhouet That would have been great. The new version is live. Let me know how it goes.
It doesn't work for me.
What I did:
- Downloaded the newest release 0.2.3
- Searched for my Slack installation path (this seems to be different for every installation)
- Started the command line with admin access
- run
math-with-slack.bat "C:\Program Files\WindowsApps\91750D7E.Slack_3.0.5.0_x64__8she8kybcnzg4\app\resources\app.asar.unpacked\src\static"
Output:
Using Slack installation at: C:\Program Files\WindowsApps\91750D7E.Slack_3.0.5.0_x64__8she8kybcnzg4\app\resources\app.asar.unpacked\src\static
Zugriff verweigert
Zugriff verweigert
Zugriff verweigert
math-with-slack has been installed. Please restart the Slack client.
Drücken Sie eine beliebige Taste . . .
It seems the script doesn't get full access right even with the console started with admin access.
I'm not sure but I think the WindowApp Folder / environment is very restricted. I'm not sure it will allow changes at all, see:
@Spenhouet Hmm, I see. I think you're right, the WindowApp folder is not editable by the user even with admin access. I don't want to hack this too much as it could be flagged as malicious code. Unfortunately, this means that the Windows Store app won't be supported. The app downloaded directly from Slack should, however, still work. If you decide to try that out, please let me know if it works.
@fsavje I guess the original slack app works as it did before. This issue was only meant for the Windows Store App.
Sad to hear that there seems to be no other way then to stop the support for the Windows Store App Slack version. Thanks for pointing this out in the math-with-slack README. 👍
Yeah, unfortunately there is no (easy) way to solve this it seems. I'm very grateful for your help! I hope it's OK that I add you as a contributor.
Sure 👍