prim-ctrl 0.7.0__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {prim_ctrl-0.7.0 → prim_ctrl-0.7.2}/PKG-INFO +9 -5
- {prim_ctrl-0.7.0 → prim_ctrl-0.7.2}/README.md +8 -4
- {prim_ctrl-0.7.0 → prim_ctrl-0.7.2}/prim_ctrl/__main__.py +26 -10
- {prim_ctrl-0.7.0 → prim_ctrl-0.7.2}/pyproject.toml +1 -1
- {prim_ctrl-0.7.0 → prim_ctrl-0.7.2}/LICENSE +0 -0
- {prim_ctrl-0.7.0 → prim_ctrl-0.7.2}/prim_ctrl/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: prim-ctrl
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Primitive Ctrl - Remote control of your phone's Primitive FTPd Android SFTP server and optionally Tailscale VPN.
|
|
5
5
|
Home-page: https://github.com/lmagyar/prim-ctrl
|
|
6
6
|
License: Apache-2.0
|
|
@@ -105,10 +105,12 @@ Optionally, if you want to edit or even contribute to the source, you also need
|
|
|
105
105
|
- Download the https://raw.githubusercontent.com/lmagyar/prim-ctrl/main/res/prim-ctrl.flo Automate flow to your phone (see [image](https://raw.githubusercontent.com/lmagyar/prim-ctrl/main/res/prim-ctrl.png) of the flow)
|
|
106
106
|
- Import it with the ... menu / Import command
|
|
107
107
|
- Enable all privileges
|
|
108
|
-
- Click on the flow, edit the
|
|
108
|
+
- Click on the flow, edit the 2nd block (Set variable google_account to...), enter your Google account's email and press Save
|
|
109
|
+
- Optionally, if the Google account your phone is registered to is different from the Google account you use to send messages to Automate (eg. you manage a phone that is a jukebox or a family member's phone and you use your personal account to send messages), edit the 3rd block (Set variable other_managing_accounts to...), enter one or more Google account's email (separated with space or comma) and press Save
|
|
109
110
|
- Start the flow
|
|
110
111
|
- Settings
|
|
111
|
-
-
|
|
112
|
+
- Safety
|
|
113
|
+
- Run on system startup: enable
|
|
112
114
|
|
|
113
115
|
### Primitive FTPd
|
|
114
116
|
|
|
@@ -174,10 +176,12 @@ Note: optionally if your laptop is accessible through Tailscale Funnel then VPN
|
|
|
174
176
|
Output: even when -b option is not used, the script will output 'connected=(local|remote)', what you can use to determine whether to use -a option for the prim-sync script
|
|
175
177
|
|
|
176
178
|
positional arguments:
|
|
177
|
-
automate-account your Google account email you set up in the Automate flow's
|
|
179
|
+
automate-account your Google account email you set up in the Automate flow's 2nd block's (Set variable google_account to...) Value field
|
|
178
180
|
automate-device the device name you can see at the Automate flow's Cloud receive block's This device field
|
|
179
181
|
automate-tokenfile filename containing Automates's Secret that located under your .secrets folder
|
|
180
|
-
(generated on https://llamalab.com/automate/cloud, use the same Google account you set
|
|
182
|
+
(generated on https://llamalab.com/automate/cloud, use the same Google account you set the automate_account option to)
|
|
183
|
+
Note: if the account you use to send messages is different from the automate_account option,
|
|
184
|
+
set it up in the Automate flow's 3rd block's (Set variable other_managing_accounts to...) Value field
|
|
181
185
|
server-name the Servername configuration option from Primitive FTPd app
|
|
182
186
|
keyfile private SSH key filename located under your .ssh folder, see the documentation of prim-sync for more details
|
|
183
187
|
|
|
@@ -79,10 +79,12 @@ Optionally, if you want to edit or even contribute to the source, you also need
|
|
|
79
79
|
- Download the https://raw.githubusercontent.com/lmagyar/prim-ctrl/main/res/prim-ctrl.flo Automate flow to your phone (see [image](https://raw.githubusercontent.com/lmagyar/prim-ctrl/main/res/prim-ctrl.png) of the flow)
|
|
80
80
|
- Import it with the ... menu / Import command
|
|
81
81
|
- Enable all privileges
|
|
82
|
-
- Click on the flow, edit the
|
|
82
|
+
- Click on the flow, edit the 2nd block (Set variable google_account to...), enter your Google account's email and press Save
|
|
83
|
+
- Optionally, if the Google account your phone is registered to is different from the Google account you use to send messages to Automate (eg. you manage a phone that is a jukebox or a family member's phone and you use your personal account to send messages), edit the 3rd block (Set variable other_managing_accounts to...), enter one or more Google account's email (separated with space or comma) and press Save
|
|
83
84
|
- Start the flow
|
|
84
85
|
- Settings
|
|
85
|
-
-
|
|
86
|
+
- Safety
|
|
87
|
+
- Run on system startup: enable
|
|
86
88
|
|
|
87
89
|
### Primitive FTPd
|
|
88
90
|
|
|
@@ -148,10 +150,12 @@ Note: optionally if your laptop is accessible through Tailscale Funnel then VPN
|
|
|
148
150
|
Output: even when -b option is not used, the script will output 'connected=(local|remote)', what you can use to determine whether to use -a option for the prim-sync script
|
|
149
151
|
|
|
150
152
|
positional arguments:
|
|
151
|
-
automate-account your Google account email you set up in the Automate flow's
|
|
153
|
+
automate-account your Google account email you set up in the Automate flow's 2nd block's (Set variable google_account to...) Value field
|
|
152
154
|
automate-device the device name you can see at the Automate flow's Cloud receive block's This device field
|
|
153
155
|
automate-tokenfile filename containing Automates's Secret that located under your .secrets folder
|
|
154
|
-
(generated on https://llamalab.com/automate/cloud, use the same Google account you set
|
|
156
|
+
(generated on https://llamalab.com/automate/cloud, use the same Google account you set the automate_account option to)
|
|
157
|
+
Note: if the account you use to send messages is different from the automate_account option,
|
|
158
|
+
set it up in the Automate flow's 3rd block's (Set variable other_managing_accounts to...) Value field
|
|
155
159
|
server-name the Servername configuration option from Primitive FTPd app
|
|
156
160
|
keyfile private SSH key filename located under your .ssh folder, see the documentation of prim-sync for more details
|
|
157
161
|
|
|
@@ -284,7 +284,7 @@ class Service(Manageable):
|
|
|
284
284
|
|
|
285
285
|
self._connect_timeout = 2
|
|
286
286
|
self._special_exceptions = ()
|
|
287
|
-
self._special_exceptions_handler : Callable[[Exception],
|
|
287
|
+
self._special_exceptions_handler : Callable[[Exception], bool] | None = None
|
|
288
288
|
|
|
289
289
|
async def _connect(self, host: str, port: int):
|
|
290
290
|
logger.debug(" Connecting with TCP to %s:%d (timeout is %ds)", host, port, self._connect_timeout)
|
|
@@ -306,10 +306,13 @@ class Service(Manageable):
|
|
|
306
306
|
except self._special_exceptions as e:
|
|
307
307
|
if availability_hint is None or availability_hint:
|
|
308
308
|
if self._special_exceptions_handler:
|
|
309
|
-
self._special_exceptions_handler(e)
|
|
309
|
+
if self._special_exceptions_handler(e):
|
|
310
|
+
raise
|
|
311
|
+
else:
|
|
312
|
+
return False
|
|
310
313
|
else:
|
|
311
314
|
logger.debug(" Unexpected ping exception: %s", LazyStr(e))
|
|
312
|
-
|
|
315
|
+
raise
|
|
313
316
|
else:
|
|
314
317
|
return False
|
|
315
318
|
except Exception as e:
|
|
@@ -323,12 +326,15 @@ class SshService(Service):
|
|
|
323
326
|
self.keyfile = keyfile
|
|
324
327
|
|
|
325
328
|
self._connect_timeout = 3
|
|
326
|
-
self._special_exceptions = (asyncssh.misc.HostKeyNotVerifiable, asyncssh.misc.PermissionDenied)
|
|
329
|
+
self._special_exceptions = (asyncssh.misc.HostKeyNotVerifiable, asyncssh.misc.PermissionDenied, asyncssh.misc.DisconnectError)
|
|
327
330
|
def _handle_special_exceptions(e: Exception):
|
|
328
331
|
if isinstance(e, asyncssh.misc.HostKeyNotVerifiable):
|
|
329
332
|
e.add_note("Check your known_hosts file, see the documentation of prim-sync for more details")
|
|
330
|
-
|
|
333
|
+
elif isinstance(e, asyncssh.misc.PermissionDenied):
|
|
331
334
|
e.add_note("Check your private SSH key file, see the documentation of prim-sync for more details")
|
|
335
|
+
else:
|
|
336
|
+
return False
|
|
337
|
+
return True
|
|
332
338
|
self._special_exceptions_handler = _handle_special_exceptions
|
|
333
339
|
|
|
334
340
|
async def _connect(self, host: str, port: int):
|
|
@@ -970,8 +976,13 @@ class Control:
|
|
|
970
976
|
|
|
971
977
|
async def execute(self, args, local: Local, phone: Phone):
|
|
972
978
|
async def _stop(restore_state: dict | None, stop_only_started: bool = False):
|
|
973
|
-
|
|
974
|
-
|
|
979
|
+
async def _suppress(coro, default: bool):
|
|
980
|
+
try:
|
|
981
|
+
return await coro
|
|
982
|
+
except:
|
|
983
|
+
return default
|
|
984
|
+
if local.vpn and phone.vpn and phone.remote_sftp and await _suppress(local.vpn.test(), True) and await _suppress(phone.vpn.test(), True):
|
|
985
|
+
if (restore_state is None or not restore_state.get(Control.PHONE_SFTP, stop_only_started)) and await _suppress(phone.remote_sftp.test(), True):
|
|
975
986
|
try:
|
|
976
987
|
await phone.remote_sftp.stop(10, 30)
|
|
977
988
|
except Exception as e:
|
|
@@ -1075,7 +1086,10 @@ class Control:
|
|
|
1075
1086
|
state[Control.CONNECTED] = Control.ZEROCONF if zeroconf_accessible else Control.REMOTE
|
|
1076
1087
|
print(StateSerializer.dumps(state))
|
|
1077
1088
|
except Exception:
|
|
1078
|
-
|
|
1089
|
+
try:
|
|
1090
|
+
await _stop(state, stop_only_started = True)
|
|
1091
|
+
except Exception as e:
|
|
1092
|
+
logger.exception_or_error(e, args)
|
|
1079
1093
|
raise
|
|
1080
1094
|
else:
|
|
1081
1095
|
try:
|
|
@@ -1098,10 +1112,12 @@ class AutomateControl(Control):
|
|
|
1098
1112
|
"Output: even when -b option is not used, the script will output 'connected=(local|remote)', what you can use to determine whether to use -a option for the prim-sync script",
|
|
1099
1113
|
formatter_class=WideHelpFormatter)
|
|
1100
1114
|
|
|
1101
|
-
parser.add_argument('automate_account', metavar='automate-account', help="your Google account email you set up in the Automate flow's
|
|
1115
|
+
parser.add_argument('automate_account', metavar='automate-account', help="your Google account email you set up in the Automate flow's 2nd block's (Set variable google_account to...) Value field")
|
|
1102
1116
|
parser.add_argument('automate_device', metavar='automate-device', help="the device name you can see at the Automate flow's Cloud receive block's This device field")
|
|
1103
1117
|
parser.add_argument('automate_tokenfile', metavar='automate-tokenfile', help="filename containing Automates's Secret that located under your .secrets folder\n"
|
|
1104
|
-
"(generated on https://llamalab.com/automate/cloud, use the same Google account you set
|
|
1118
|
+
"(generated on https://llamalab.com/automate/cloud, use the same Google account you set the automate_account option to)\n"
|
|
1119
|
+
"Note: if the account you use to send messages is different from the automate_account option,\n"
|
|
1120
|
+
"set it up in the Automate flow's 3rd block's (Set variable other_managing_accounts to...) Value field")
|
|
1105
1121
|
|
|
1106
1122
|
Control.setup_parser_arguments(parser)
|
|
1107
1123
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "prim-ctrl"
|
|
3
|
-
version = "0.7.
|
|
3
|
+
version = "0.7.2"
|
|
4
4
|
description = "Primitive Ctrl - Remote control of your phone's Primitive FTPd Android SFTP server and optionally Tailscale VPN."
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
authors = ["Laszlo Magyar <lmagyar1973@gmail.com>"]
|
|
File without changes
|
|
File without changes
|