Skip to content

Commit 39b9965

Browse files
committed
remove updater for alfred gallery eligibility
1 parent 7c06dda commit 39b9965

File tree

1 file changed

+0
-67
lines changed

1 file changed

+0
-67
lines changed

src/main.jxa.js

-67
Original file line numberDiff line numberDiff line change
@@ -123,71 +123,6 @@ const GH_BASE_URL = 'https://github.com';
123123
const GH_CONTENT_BASE_URL = 'https://raw.githubusercontent.com';
124124
const REPOSITORY = 'stephancasas/alfred-mouseless-messenger';
125125

126-
function checkForUpdate() {
127-
if (
128-
new Date().getTime() <
129-
parseInt(App.systemAttribute('alfred_mm_next_update'))
130-
) {
131-
return;
132-
}
133-
134-
// set next update poll
135-
const prefs = App.systemAttribute('alfred_preferences');
136-
const workflowUid = App.systemAttribute('alfred_workflow_uid');
137-
const workflowDir = `${prefs}/workflows/${workflowUid}`;
138-
Application('System Events')
139-
.propertyListFiles.byName(`${workflowDir}/info.plist`)
140-
.propertyListItems.byName('variables')
141-
.propertyListItems.byName('alfred_mm_next_update')
142-
.value.set(`${new Date().getTime() + 259200 * 1000}`);
143-
144-
console.log('Mouseless Messenger will check for updates...');
145-
146-
const cmd = [
147-
`curl`,
148-
`-Ls`,
149-
`-o /dev/null`,
150-
`-w %{url_effective}`,
151-
`${GH_BASE_URL}/${REPOSITORY}/releases/latest`,
152-
].join(' ');
153-
154-
const newUpdateToken = App.doShellScript(cmd);
155-
156-
if ($read('update_token') == $write('update_token', newUpdateToken)) {
157-
console.log('Mouseless Messenger is up-to-date.');
158-
return;
159-
}
160-
161-
console.log('Mouseless Messenger found an update.');
162-
163-
applyUpdate();
164-
}
165-
166-
function applyUpdate() {
167-
const cmd = [
168-
`curl`,
169-
`${GH_CONTENT_BASE_URL}/${REPOSITORY}/main/updater.jxa.js`,
170-
].join(' ');
171-
172-
console.log('Mouseless Messenger will download the updater...');
173-
174-
// use correct carriage-return/line-feed chars
175-
const updater = App.doShellScript(cmd).replace(/\r/g, '\n');
176-
177-
if (updater.split(/\n/)[0] != `#!/usr/bin/env osascript -l JavaScript`) {
178-
console.log('Something is wrong with the updater.');
179-
return;
180-
}
181-
182-
$write('updater.jxa.js', updater);
183-
App.doShellScript(`chmod +x '${CACHE_DIR}/updater.jxa.js'`);
184-
185-
console.log('Mouseless Messenger downloaded the updater.');
186-
console.log('Mouseless Messenger will attempt to apply updates.');
187-
188-
App.doShellScript(`${`${CACHE_DIR}/updater.jxa.js`.replace(/\s/g, '\\ ')} &`);
189-
}
190-
191126
const CACHE = {};
192127

193128
function resolveColorScheme(scheme = '') {
@@ -521,8 +456,6 @@ function getChatHTML() {
521456
*/
522457

523458
function run(_) {
524-
checkForUpdate();
525-
526459
const chats = [...new Set(getMessages().map((message) => message.chat_id))]
527460
.map((chatId) => {
528461
const msg = getMessages().find(({ chat_id }) => chat_id === chatId);

0 commit comments

Comments
 (0)