Skip to content
This repository was archived by the owner on Jun 3, 2018. It is now read-only.

Commit dd1dda7

Browse files
committed
moving native client\'s id to config.js
1 parent a8113fe commit dd1dda7

File tree

9 files changed

+82
-35
lines changed

9 files changed

+82
-35
lines changed

config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
'use strict';
22

3+
exports.id = 'com.add0n.stylus';
4+
35
exports.ids = {
46
chrome: [
57
'hhdaknihlbgjoaiaceldhnbbmogabcpk', // Stylus External Editor Integration (Chrome)
6-
'djlnckfpakjlpfddhboajjmaeljfaacn', // Stylus External Editor Integration (Opera)
8+
'bfkhfaldfclkfjdmgfibhknpoiaoelih', // Stylus External Editor Integration (Opera)
79
],
810
firefox: [
911
'95fce6c2e847856344b2156491239d95f56c7fc1@temporary-addon', // Stylus External Editor Integration

install.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ else
1414
../node/x86/node install.js --add_node $1
1515
fi
1616
fi
17-

linux/app/install.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ function exists (directory, callback) {
4040
one();
4141
}
4242

43-
var dir = path.join(share, 'com.add0n.stylus');
44-
var name = 'com.add0n.stylus';
45-
var ids = require('./config.js').ids;
43+
var {id, ids} = require('./config.js');
44+
var dir = path.join(share, id);
45+
var name = id;
4646

4747
function manifest (root, type, callback) {
4848
console.log(' -> Creating a directory at', root);

linux/uninstall.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
#!/bin/bash
2-
#
3-
rm ~/.config/google-chrome/NativeMessagingHosts/com.add0n.stylus.json
4-
rm ~/.config/chromium/NativeMessagingHosts/com.add0n.stylus.json
5-
rm ~/.mozilla/native-messaging-hosts/com.add0n.stylus.json
6-
rm -r ~/com.add0n.stylus
72

3+
cd ./app
4+
5+
MACHINE_TYPE=`uname -m`
6+
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
7+
id=`../node/x64/node -e "process.stdout.write(require('./config.js').id)"`
8+
else
9+
id=`../node/x86/node -e "process.stdout.write(require('./config.js').id)"`
10+
fi
11+
12+
echo "Native Client id is \"${id}\""
13+
echo
14+
15+
echo " .. Removing manifest file for Google Chrome"
16+
rm ~/.config/google-chrome/NativeMessagingHosts/${id}.json
17+
echo " .. Removing manifest file for Chromium"
18+
rm ~/.config/chromium/NativeMessagingHosts/${id}.json
19+
echo " .. Removing manifest file for Mozilla Firefox"
20+
rm ~/.mozilla/native-messaging-hosts/${id}.json
21+
echo " .. Removing executable"
22+
rm -r ~/${id}
23+
24+
echo
825
echo ">>> Native Client is removed <<<".

mac/app/install.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ function exists (directory, callback) {
4040
one();
4141
}
4242

43-
var dir = path.join(share, 'com.add0n.stylus');
44-
var name = 'com.add0n.stylus';
45-
var ids = require('./config.js').ids;
43+
var {id, ids} = require('./config.js');
44+
var dir = path.join(share, id);
45+
var name = id;
4646

4747
function manifest (root, type, callback) {
4848
console.log(' -> Creating a directory at', root);

mac/uninstall.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
#!/bin/bash
2-
#
3-
rm ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.add0n.stylus.json
4-
rm ~/Library/Application\ Support/Chromium/NativeMessagingHosts/com.add0n.stylus.json
5-
rm ~/Library/Application\ Support/Mozilla/NativeMessagingHosts/com.add0n.stylus.json
6-
rm -r ~/com.add0n.stylus
72

3+
cd ./app
4+
5+
MACHINE_TYPE=`uname -m`
6+
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
7+
id=`../node/x64/node -e "process.stdout.write(require('./config.js').id)"`
8+
else
9+
id=`../node/x86/node -e "process.stdout.write(require('./config.js').id)"`
10+
fi
11+
12+
echo "Native Client id is \"${id}\""
13+
echo
14+
15+
echo " .. Removing manifest file for Google Chrome"
16+
rm ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/${id}.json
17+
echo " .. Removing manifest file for Chromium"
18+
rm ~/Library/Application\ Support/Chromium/NativeMessagingHosts/${id}.json
19+
echo " .. Removing manifest file for Mozilla Firefox"
20+
rm ~/Library/Application\ Support/Mozilla/NativeMessagingHosts/${id}.json
21+
echo " .. Removing executable"
22+
rm -r ~/${id}
23+
24+
echo
825
echo ">>> Native Client is removed <<<".

windows/app/install.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,19 @@ function exists (directory, callback) {
1515
});
1616
}
1717

18-
var dir = path.join(process.argv[2], 'com.add0n.stylus');
19-
var name = 'com.add0n.stylus';
20-
var ids = require('./config.js').ids;
18+
var {id, ids} = require('./config.js');
19+
var dir = path.join(process.argv[2], id);
20+
var name = id;
21+
22+
var {exec} = require('child_process');
23+
24+
console.log('.. Writting to Chrome Registry');
25+
console.log(`.. Key: HKCU\\Software\\Google\\Chrome\\NativeMessagingHosts\\${id}`);
26+
exec(`REG ADD "HKCU\\Software\\Google\\Chrome\\NativeMessagingHosts\\${id}" /ve /t REG_SZ /d "%LocalAPPData%\\${id}\\manifest-chrome.json" /f`);
27+
28+
console.log(`.. Writting to Firefox Registry`);
29+
console.log(`.. Key: HKCU\\SOFTWARE\\Mozilla\\NativeMessagingHosts\\${id}`);
30+
exec(`REG ADD "HKCU\\SOFTWARE\\Mozilla\\NativeMessagingHosts\\${id}" /ve /t REG_SZ /d "%LocalAPPData%\\${id}\\manifest-firefox.json" /f`);
2131

2232
function manifest (type, callback) {
2333
exists(dir, (e) => {

windows/install.bat

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
@echo off
22

3-
ECHO .. Writting to Chrome Registry
4-
ECHO .. Key: HKCU\Software\Google\Chrome\NativeMessagingHosts\com.add0n.stylus
5-
REG ADD "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.add0n.stylus" /ve /t REG_SZ /d "%LocalAPPData%\com.add0n.stylus\manifest-chrome.json" /f
6-
7-
ECHO .. Writting to Firefox Registry
8-
ECHO .. Key: HKCU\SOFTWARE\Mozilla\NativeMessagingHosts\com.add0n.stylus
9-
FOR %%f in ("%LocalAPPData%") do SET SHORT_PATH=%%~sf
10-
REG ADD "HKCU\SOFTWARE\Mozilla\NativeMessagingHosts\com.add0n.stylus" /ve /t REG_SZ /d "%SHORT_PATH%\com.add0n.stylus\manifest-firefox.json" /f
11-
123
pushd "%~dp0"
134
CD app
145

windows/uninstall.bat

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
@echo off
22

3+
pushd "%~dp0"
4+
CD app
5+
6+
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
7+
FOR /f %%i in ('..\node\x64\node.exe -e "process.stdout.write(require('./config.js').id)"') do SET id=%%i
8+
) ELSE (
9+
FOR /f %%i in ('..\node\x86\node.exe -e "process.stdout.write(require('./config.js').id)"') do SET id=%%i
10+
)
11+
12+
echo sss%id%
13+
314
echo .. Deleting Chrome Registry
4-
REG DELETE "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.add0n.stylus" /f
15+
REG DELETE "HKCU\Software\Google\Chrome\NativeMessagingHosts\%id%" /f
516

617
echo .. Deleting Firefox Registry
718
for %%f in ("%LocalAPPData%") do SET SHORT_PATH=%%~sf
8-
REG DELETE "HKCU\SOFTWARE\Mozilla\NativeMessagingHosts\com.add0n.stylus" /f
19+
REG DELETE "HKCU\SOFTWARE\Mozilla\NativeMessagingHosts\%id%" /f
920

10-
echo .. Deleting com.add0n.stylus
11-
RMDIR /Q /S "%LocalAPPData%\com.add0n.stylus"
21+
echo .. Deleting %id%
22+
RMDIR /Q /S "%LocalAPPData%\%id%"
1223

1324
echo.
14-
echo ^>^>^> Done! ^<^<^<
25+
echo ^>^>^> Native Client is removed ^<^<^<
1526
echo.
1627
pause
1728

0 commit comments

Comments
 (0)