Skip to content

Commit

Permalink
Update workflow version
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 21, 2024
1 parent ad5bd14 commit f7d9390
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 17 deletions.
4 changes: 2 additions & 2 deletions local-network/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
> display local network info, like HTTP Proxy
> Display local network info, like HTTP Proxy、Public IP Address.


[![](https://img.shields.io/badge/version-v0.3-green?style=for-the-badge)](https://img.shields.io/badge/version-v0.3-green?style=for-the-badge)
[![](https://img.shields.io/badge/version-v0.4-green?style=for-the-badge)](https://img.shields.io/badge/version-v0.4-green?style=for-the-badge)
[![](https://img.shields.io/badge/download-click-blue?style=for-the-badge)](https://github.com/alanhe421/alfred-workflows/raw/master/local-network/Local%20Network.alfredworkflow)


Expand Down
Binary file added local-network/src/icon/public-ip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 38 additions & 9 deletions local-network/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
*/
const { utils, Workflow } = require('@stacker/alfred-utils');
const { getCurProxy } = require('./network-utils');
const { exec } = require('child_process');
const [, ,] = process.argv;
const wf = new Workflow();
(function () {
const {http, https, socks} = getCurProxy();
const { http, https, socks } = getCurProxy();

wf.addWorkflowItem({
item: {
uid: 'http proxy',
title: 'HTTP Proxy',
subtitle: buildHttpProxySubtitle(http),
icon: {
Expand All @@ -21,12 +23,14 @@ const wf = new Workflow();
text: {
copy: http.enabled ? `${http.host}:${http.port}` : '',
largetype: http.enabled ? `${http.host}:${http.port}` : ''
}
},
arg: http.enabled ? `${http.host}:${http.port}` : ''
}
});

wf.addWorkflowItem({
item: {
uid: 'https proxy',
title: 'HTTPS Proxy',
subtitle: buildHttpProxySubtitle(https),
icon: {
Expand All @@ -35,11 +39,13 @@ const wf = new Workflow();
text: {
copy: https.enabled ? `${https.host}:${https.port}` : '',
largetype: https.enabled ? `${https.host}:${https.port}` : ''
}
},
arg: https.enabled ? `${https.host}:${https.port}` : ''
}
});
wf.addWorkflowItem({
item: {
uid: 'socks proxy',
title: 'SOCKS Proxy',
subtitle: buildHttpProxySubtitle(socks),
icon: {
Expand All @@ -48,14 +54,37 @@ const wf = new Workflow();
text: {
copy: socks.enabled ? `${socks.host}:${socks.port}` : '',
largetype: socks.enabled ? `${socks.host}:${socks.port}` : ''
}
},
arg: socks.enabled ? `${socks.host}:${socks.port}` : ''
}
})
wf.run();
});
exec('curl ifconfig.me', { encoding: 'utf8', timeout: 1000 }, (error, stdout) => {
if (!error) {
wf.addWorkflowItem({
item: {
uid: 'public ip address',
title: 'Public IP Address',
subtitle: stdout,
icon: {
path: 'icon/public-ip.png'
},
text: {
copy: stdout,
largetype: stdout
},
arg: stdout
}
});
}
wf.run({
});
});
})();

function buildHttpProxySubtitle(http) {
return `${
http.enabled ? utils.emoji.greenChecked : utils.emoji.greenUnChecked
}${!(http.host || +http.port) ? 'proxy not enabled' : `${http.host}:${http.port}`}`;
return `${!(http.host || +http.port)
? 'proxy not enabled'
: `${http.host}:${http.port}`
} ${http.enabled ? utils.emoji.greenChecked : utils.emoji.greenUnChecked
}`;
}
50 changes: 45 additions & 5 deletions local-network/src/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,50 @@
<key>category</key>
<string>Self-Dev</string>
<key>connections</key>
<dict/>
<dict>
<key>ED50F1E8-F086-41E8-A156-B4C052DD1AA4</key>
<array>
<dict>
<key>destinationuid</key>
<string>B0B2C729-66ED-45E0-940B-2F72D781565A</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Alan He</string>
<key>description</key>
<string>display local network info</string>
<string>Display local network info</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Local Network</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>autopaste</key>
<false/>
<key>clipboardtext</key>
<string>{query}</string>
<key>ignoredynamicplaceholders</key>
<false/>
<key>transient</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.output.clipboard</string>
<key>uid</key>
<string>B0B2C729-66ED-45E0-940B-2F72D781565A</string>
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -46,7 +79,7 @@
<key>runningsubtext</key>
<string>waiting</string>
<key>script</key>
<string>/usr/local/bin/node ./index.js</string>
<string>node ./index.js</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand All @@ -69,9 +102,16 @@
</dict>
</array>
<key>readme</key>
<string>&gt; display local network info, like HTTP Proxy</string>
<string>&gt; Display local network info, like HTTP Proxy、Public IP Address.</string>
<key>uidata</key>
<dict>
<key>B0B2C729-66ED-45E0-940B-2F72D781565A</key>
<dict>
<key>xpos</key>
<real>555</real>
<key>ypos</key>
<real>130</real>
</dict>
<key>ED50F1E8-F086-41E8-A156-B4C052DD1AA4</key>
<dict>
<key>xpos</key>
Expand All @@ -85,7 +125,7 @@
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>0.3</string>
<string>0.4</string>
<key>webaddress</key>
<string>https://github.com/alanhg/alfred-workflows/tree/master/local-network</string>
</dict>
Expand Down
3 changes: 2 additions & 1 deletion whistle/src/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string>npm i whistle@latest -g</string>
<string>npm i whistle@latest -g
w2 restart</string>
</dict>
<key>type</key>
<string>alfred.workflow.action.terminalcommand</string>
Expand Down

0 comments on commit f7d9390

Please sign in to comment.