1 | static Map<S, Long> phonePublicCommBot_clients = synchroHashMap(); |
2 | sbool phonePublicCommBot_brave; // true = expose yourself on public IP |
3 | |
4 | static bool phonePublicCommBot() {
|
5 | if (eq("true", trim(readTextFile(getProgramFile("#1004118", "brave")))))
|
6 | phonePublicCommBot_brave = true; |
7 | |
8 | if (doIHavePublicIPs()) {
|
9 | if (phonePublicCommBot_brave) |
10 | print("NOTE: WE'RE BRAVE (PUBLIC IP)!!!!!!!");
|
11 | else {
|
12 | print("JavaX Safety Note: We're on a public IP!! Not starting public comm bot.");
|
13 | false; |
14 | } |
15 | } |
16 | |
17 | Android3 a = new Android3("Public Comm Bot at " + getComputerID() + ".");
|
18 | a.publicOverride = true; |
19 | a.useMultiPort = false; |
20 | a.startPort = 4999; |
21 | a.console = false; |
22 | a.responder = makeResponder(new O {
|
23 | S answer(S s) {
|
24 | DialogIO io = makeAndroid3_io.get(); |
25 | if (io != null) |
26 | phonePublicCommBot_clients.put(io.getSocket().getInetAddress().getHostAddress(), now()); |
27 | |
28 | new Matches m; |
29 | |
30 | if "clients last seen" |
31 | ret structure(phonePublicCommBot_clients); |
32 | |
33 | if "your ips" |
34 | ret structure(getMyIPs()); |
35 | |
36 | if "test" |
37 | return "test!"; |
38 | |
39 | if "ping" |
40 | return "pong!"; |
41 | |
42 | if (match3("please forward to bot *: *", s, m)) {
|
43 | S bot = unquote(m.m[0]); |
44 | S line = unquote(m.m[1]); |
45 | ret sendToLocalBotOpt(bot, line); |
46 | } |
47 | |
48 | if "please forward to vm: *" |
49 | ret sendToThisVM($1); |
50 | |
51 | null; |
52 | } |
53 | }); |
54 | |
55 | makeAndroid(a); |
56 | if (a.port != a.startPort) {
|
57 | //print("Could not register port " + a.startPort + ", disposing.");
|
58 | a.dispose(); |
59 | false; |
60 | } |
61 | print("Public Comm Bot started.");
|
62 | true; |
63 | } |
Began life as a copy of #1004080
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1004118 |
| Snippet name: | phonePublicCommBot |
| Eternal ID of this version: | #1004118/2 |
| Text MD5: | e8a078c73912b20b9f21add6a8794914 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-05-03 14:58:37 |
| Source code size: | 1745 bytes / 63 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 825 / 1332 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |