Commit graph

72 commits

Author SHA1 Message Date
Oliver Blanthorn
47f90395eb
Rerename Windows native install script 2018-07-25 14:39:59 +01:00
Jeff King
fb0bfc0807 native: feed stdin of subprocess for "run"
There's currently no way to tell the native messenger to
provide a particular stdin to a "run" command. This leads to
awkward uses of here-docs, which in turn require hacks like
the one in 4a5dcd7557.

Instead, let's take the "content" field from the message
body and feed that to the command's stdin, which gives us a
more robust channel for passing arbitrary bytes.

Note that we have to switch to using subprocess.Popen's
communicate() method, which will make sure we don't deadlock
if the input or output exceeds a pipe buffer.

Note also that when no stdin is provided by the caller
(i.e., all current cases), we'll pass an empty string. This
actually fixes a minor bug. Because we didn't override the
command's stdin argument, it's hooked to the messenger's
stdin, which is the pipe coming from firefox. If the command
tries to read, it (and the messenger) will hang forever,
since firefox is waiting for the messenger to respond before
writing anything else.

I bumped the native messenger version. This is mostly
backwards compatible (existing callers just don't send any
stdin content at all). But a caller that wants to send stdin
should check to make sure we have at least 0.1.7.
2018-07-18 01:18:13 -04:00
Jeff King
a9fb9b65e9 native: use os.join instead of backslashes for debug path
This makes debugging work correctly on Linux.  Otherwise
you'll generally get EPERM as `/home/user\.tridactyl` is a
path in `/home`, which you likely don't have access to
write.
2018-07-18 01:03:12 -04:00
Babil Golam Sarwar
92e99aabbb
Add support to enforce minimum version for PowerShell 2018-07-13 08:46:09 +10:00
Babil Golam Sarwar
02c76e0f00
Fix PowerShell auto-close when native-messenger installation fails 2018-07-11 17:08:44 +10:00
Babil Golam Sarwar
be245d5dfa
Add TLS 1.1/1.2 support to Invoke-WebRequest 2018-07-11 11:37:34 +10:00
Vladimir Macko
2fc9eb0c54 Fix bug introduced in #733 2018-06-25 15:43:14 +02:00
Babil Golam Sarwar
54aca0fcf7
Merge branch 'master' of https://github.com/cmcaine/tridactyl 2018-06-25 07:42:31 +10:00
Babil Golam Sarwar
e0c61d53c5
Fixes Non-ASCII username issue reported in #731 2018-06-25 07:41:58 +10:00
Vladimir Macko
310f7b5900 Improve robustness of Get-PythonVersionStatus 2018-06-24 01:14:01 +02:00
Babil Golam Sarwar
683c3dc086 Fix native_main.py URL in win_install.ps1 2018-06-08 14:54:23 +10:00
Oliver Blanthorn
173e4fe896
Make gen_native_message executable 2018-05-30 11:25:05 +01:00
Babil Golam Sarwar
1f7c042d64 Merge branch 'master' into gsbabil/fix-restart-command-on-windows 2018-05-29 12:38:03 +10:00
Babil Golam Sarwar
75f21da384 Add consistent Python formatting 2018-05-29 12:08:08 +10:00
Oliver Blanthorn
2cc5662764
Output exe in artifacts with xpis etc 2018-05-28 14:00:05 +01:00
Oliver Blanthorn
e0810c5694
Remove old files 2018-05-28 13:16:25 +01:00
Babil Golam Sarwar
65b9275667
Add native message maker 2018-05-28 11:17:47 +01:00
Babil Golam Sarwar
47d247aff7 Fix restart on Windows without needing Firefox on %PATH% 2018-05-28 00:32:30 +10:00
Babil Golam Sarwar
9d5ce40505 Remove -ProfileManager and -new-tab during Firefox restart 2018-05-27 10:19:26 +10:00
Babil Golam Sarwar
93ca6c50a6 Fix :restart under restricted PowerShell 2018-05-26 10:18:23 +10:00
Babil Golam Sarwar
d81f503259 Use -new-tab to activate Tridactyl on restart 2018-05-25 14:06:29 +10:00
Babil Golam Sarwar
00baee326f Fix "parent.lock" path and Firefox restart params 2018-05-24 17:23:59 +10:00
Babil Golam Sarwar
66444af20a Refactor and clean-up Python codes 2018-05-24 13:06:41 +10:00
Babil Golam Sarwar
fdc6f77b65 Merge branch 'master' into gsbabil/fix-restart-command-on-windows 2018-05-23 18:59:32 +10:00
Babil Golam Sarwar
c30327f73e Fix :restart command on Windows 2018-05-23 18:08:47 +10:00
Babil Golam Sarwar
abd4a7546c Remove test_native_main.py from this PR branch 2018-05-21 12:09:04 +10:00
Babil Golam Sarwar
2f4ddc033e Add minor Windows specific revises to build.sh 2018-05-20 09:32:31 +10:00
Babil Golam Sarwar
a940453958 Add -NoPython flag support to win_install.ps1
This patch replaces the previous `-UsePython` flag with `-NoPython`.
Essentially this flag replaces the native messenger installation
behavior with the following new strategy on Windows:

  * Look for Python-3 in user's Windows environment

    - If Python-3 is found, install `native_main.py` as the native
      messenger binary

    - If Python-3 is _not_ found, install `native_main.exe` as the
      native messenger binary
2018-05-20 06:21:35 +10:00
Babil Golam Sarwar
2f8689cf3d Add OpenPGP signature support for native_main.exe 2018-05-19 14:14:32 +10:00
Babil Golam Sarwar
f31184fb2e Add test script for native_main.py
An example usage of `test_native_main.py` is added below:

```
  $ ./test_native_main.py "version" | ./native_main.py

  {"version": "0.1.5"}
```
2018-05-18 18:32:56 +10:00
Babil Golam Sarwar
42f5c3d3ca Refactor download URI location in win_install.ps1 2018-05-18 13:37:30 +10:00
Babil Golam Sarwar
bf920989f3 Add compiled native_main.exe support on Windows
This commit adds support for comiling `native_main.py` into
`native_main.exe` using [PyInstaller][0].

By default, the Powershell installer script would use the compiled
EXE version for Windows. However, the old behaviour can achieved by
using the `-UsePython` flag to `win_install.ps1`.

Currently, the `native_main.exe` is built every time
`scripts/build.sh` is invoked. However, this behavior can be
adjusted by invoking the build script as shown below:

```
  PYINSTALLER="0" npm run build
```

[0]: https://www.pyinstaller.org
2018-05-18 11:44:01 +10:00
Oliver Blanthorn
cb349b477e
Bump native version 2018-05-17 17:34:02 +01:00
Michal Koutný
98df8fff8e
Fix native_main 'temp' command for python < 3.5.0
We are passing None value to mkstemp which is only possible since python
3.5.0 [1]. Let's use our own mask with empty string as the prefix when
None is given. That works with both python API versions.

[1]
ad577b938b
2018-05-17 17:33:36 +01:00
Oliver Blanthorn
17a1b318a6
Ours is not to reason why: fix #544 2018-05-17 13:54:56 +01:00
Babil Golam Sarwar
aee6d59e01
Fix minor typo 2018-05-17 12:19:55 +01:00
Babil Golam Sarwar
32e74a0e76
Fix some minor typo and lint errors 2018-05-17 12:19:54 +01:00
Babil Golam Sarwar
31ee1e37e6
Add minor revises to the Powershell script 2018-05-17 12:19:53 +01:00
Babil Golam Sarwar
74326041b3
Overhaul the Powershell script to address comments at #532 2018-05-17 12:19:53 +01:00
Babil Golam Sarwar
c464e00cc1
Add native-messenger support for Windows 2018-05-17 12:19:53 +01:00
Oliver Blanthorn
e5477283fd
Update changelog, bump native version 2018-05-15 22:58:52 +01:00
Lars Kellogg-Stedman
861110a76d provide hostname hint in editor temporary files
when calling an external editor, include the hostname of the remote
site in the generated temporary filename.

Closes #495
2018-05-11 13:33:40 -04:00
Lars Kellogg-Stedman
e23e972da4 native_main.py: close file desciptor returned by mkstemp
Python's tempfile.mkstemp method returns an open file descriptor, but
native_main.py was ignoring that and re-opening the file.  This commit
modifies the code to use os.fdopen so that the file descriptor is
closed when exiting the 'with ...' context manager.
2018-05-11 09:49:40 -04:00
Oliver Blanthorn
d428e2e9b0
Fix #513: Make Native.read understand ~ 2018-05-10 21:40:13 +01:00
Isaac Khor
5a7c786840
Add source for RC files, source_quiet at startup
Commit attributed to Isaac as he was instrumental to getting this in.
@bovine3dom added all of the bugs.
2018-05-10 21:38:52 +01:00
glacambre
afbbf3ee4c
native_{main.py,background.ts}: Add version check for getenv() 2018-05-10 13:01:30 +02:00
glacambre
b34397f315
native_{main.py,background}.ts: Add getenv() and ffargs() 2018-05-09 22:09:10 +02:00
Colin Caine
2c1538b633 Depip installer 2018-05-09 13:46:51 +01:00
Colin Caine
cd8fd2c9f5 Make native install script more robust
Thanks to @i5513 on riot for reporting that our script broke on debian
without an error message.

Also refactored the sed escape stuff because what even is code re-use.
2018-05-09 12:51:01 +01:00
Oliver Blanthorn
4e7a4b9b0f
Remove obsolete CSS changer 2018-05-05 13:19:29 +01:00