-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New solution to send phone logs to the developer #609
Comments
Several options:
|
After considering those options, it looks like the main options are:
The advantage with (1) is that it will work even if our server is down. For the record, we would probably want to use WebCrypto with the Cloud Storage option (https://www.w3.org/TR/WebCryptoAPI/#cloud-storage). And we would get started on actually supported keyfiles in the app. However, it is a fairly complex change for what is a 10% use case. The advantage with (2) is that we can implement it very easily - just launch a new docker container. And we could fairly easily do some automation on the backend to automatically file issues on GitHub when a new entry is received. |
Jose (https://jose.readthedocs.io/en/latest/) is a wrapper that supports encryption/decryption. There's a nice npm package for it https://www.npmjs.com/package/jose So maybe this is not too hard after all? |
Implementing this will also allow us to make progress with #599 |
Ran into problems with uploading from another iOS user as well, tried multiple times to get them to send - email never arrived. |
The flask code for https://github.com/psty-io/psty-api/ seems fairly straightforward.
|
It looks like it is very difficult to read the application storage directory, at least on android through the cordova file plugin Adding some code to browse through directories:
and trying
we get
the |
This seems to be a subtle issue with the way that the filesystems are registered. Note the difference in the rootUri across working and not working.
|
So this is because of this code:
calls
|
Ok, so using the filesystem with the full path to directly get a file works. Listing directories still doesn't work, but that is OK.
|
for the record, using
So we can potentially remove the file dependency in the future. However, we still use the file dependency for:
Also the path ( So we will continue to use the filesystem plugin for now, but can return to this as part of a bigger refactoring to remove the file plugin. |
First implementation to upload is done:
with
However, I wonder if this is the right approach to take. File uploads typically use FormData to send the information, which allows us to send a file name, and also to use whatever encoding the standard file upload implementations use. Let's see if we can manually use FormData instead. |
We can create a FormData object programatically and append
the value can be a Blob, or File, which is a subclass of Blob.
So it seems like we should be able to append that directly to the This would also allow us to, for example, add a message to the form later. |
Alas, we can't append that directly. Looks like we need to load it first.
|
So the file object returned from the cordova plugin is almost but not quite the file object from javascript In particular, it does not support |
And we can't create a new
|
This appears to be because of inconsistent support for blobs On the most recent chrome:
In the emulator
And it looks like |
passing the raw binString works with the classic append method.
Does not work with the append method that takes a name.
|
Wrapping the BinString in a blob doesn't work.
|
Instead of emailing it. This is a partial fix for e-mission/e-mission-docs#609 Has only been tested on android, needs to be tested on iOS as well Main changes: - add a new upload service - figure out how to read the phone logs into memory from the app ecosystem - figure out how to format them as phone data - include a popup to gather additional information - combine info from popup along with phone logs and upload to a test site Change the control screen to upload instead of emailing logs There are other improvements we can make, but let's get this checked in first
Created a simple repository with a flask webserver for uploading bug logs. Flask plugins include
Currently trying to figure out how to format the post message so it is handled properly by the server.
|
Tried uploading some files to psty.io, headers are
While uploading from the phone, we now get
|
Following the instructions from https://withintent.uncorkedstudios.com/multipart-form-data-file-upload-with-angularjs-c23bf6eeb298 We now get a request that looks like this
The data is:
But on the server, I still have:
Time to check the flask message parsing. |
It is because we added the formdata as a blob. Since it is not a "file" it doesn't show up as a file. It shows up as formdata instead. |
One minor issue is that the file sizes seem to be slightly different
|
Here it is
|
While trying to save it, found an issue with the flask-uploader.
Looking at additional documentation: I think that this might be because we are not uploading it as "a file". The stackoverflow examples also have a bunch of stuff around form validation which I am not sure we want to do since we are not generating a form from the server. Do I want to define a form? What does it mean to get form.photo.data? Going to save manually instead using the code from psty.io |
by manually saving the file, I can now see the file, but it is corrupted, undoubtedly because the file sizes are different |
Switching to only sending the file instead of formdata, we get the data as bytes inside flask
|
So this is a known issue, but kind of complicated |
Switching to
File sizes match
And decoding the buffer works fine
|
wrapping the ArrayBuffer in a DataView fixes this.
|
Does not work while wrapped into FormData
with the raw message being:
Let's try the option of encoding the additional paramters with URL encoding |
Encoding additional parameters with URL encoding works! So now passing in the reason and the timezone.
Right now, on the server side, the reason gets put into the filename, but we can potentially create an sqlite database and also decode logs automatically in the future.
|
- Read the data as an Array Buffer (e-mission/e-mission-docs#609 (comment)) - Wrap the ArrayBuffer as a DataView (e-mission/e-mission-docs#609 (comment)) - Upload directly instead of using `append` - Change the type to `undefined` instead of `"undefined"` so we are likely to have it filled in properly _ use both reqular params and a post message to pass metadata Some cleanup required, but wanted to check in working version first.
Closing this now. |
Right now, we have functionality to send phone logs to the developer (me).
This has the advantage of using a mechanism that is separate from the app itself so it works even if the login is broken or the server is down.
However, recently, I have found a couple of problems:
And of course, it is also dependent on one developer and her email. There is no way to share the load between multiple members of a team, for example. We may want to use an alternate technique to upload the logs.
The text was updated successfully, but these errors were encountered: