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

fix(*): Support for send 25Mb+ files #771

Merged
merged 13 commits into from Oct 2, 2017

Conversation

Projects
None yet
4 participants
@binsee
Member

binsee commented Aug 31, 2017

  1. Upload a file larger than 25Mb.
  2. Limit the upload file to no more than 100Mb.
  3. According to webwxapp perfect upload processing.
  4. Increase the upload and handling of upload exceptions.

Issues: #766

@binsee

This comment has been minimized.

Show comment
Hide comment
@binsee
Member

binsee commented Aug 31, 2017

image

@zixia zixia requested a review from mukaiu Aug 31, 2017

@zixia zixia assigned hczhcz and lijiarui and unassigned hczhcz and lijiarui Aug 31, 2017

@zixia zixia requested review from hczhcz, lijiarui and Chatie/contributor Aug 31, 2017

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Aug 31, 2017

Member

Thank you @binsee!

This PR looks good to me. Please get more approvements from other contributors and I'll be able to merge this PR after we got three approvements.

Cheers!

Member

zixia commented Aug 31, 2017

Thank you @binsee!

This PR looks good to me. Please get more approvements from other contributors and I'll be able to merge this PR after we got three approvements.

Cheers!

@zixia zixia self-requested a review Aug 31, 2017

@zixia

zixia approved these changes Aug 31, 2017

@zixia zixia requested a review from ax4 Sep 12, 2017

Show outdated Hide outdated src/puppet-web/puppet-web.ts
const id = 'WU_FILE_' + this.fileId
this.fileId++
const hostname = await this.browser.hostname()
const headers = {
Referer: `https://${hostname}`,
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36',

This comment has been minimized.

@hczhcz

hczhcz Sep 16, 2017

Member

Just curious.. Why does the default UA fail here?

@hczhcz

hczhcz Sep 16, 2017

Member

Just curious.. Why does the default UA fail here?

This comment has been minimized.

@binsee

binsee Oct 2, 2017

Member

Sorry, I did not test other UA.

@binsee

binsee Oct 2, 2017

Member

Sorry, I did not test other UA.

@hczhcz

hczhcz approved these changes Sep 24, 2017

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Sep 24, 2017

Member

Awesome, thanks all for the code review which will help the Wechaty better!

@binsee Could you please resolve the conflicts in your PR? I'll be able to merge it after that.

Member

zixia commented Sep 24, 2017

Awesome, thanks all for the code review which will help the Wechaty better!

@binsee Could you please resolve the conflicts in your PR? I'll be able to merge it after that.

@binsee

This comment has been minimized.

Show comment
Hide comment
@binsee

binsee Sep 24, 2017

Member

I will deal with this problem as soon as possible.

Member

binsee commented Sep 24, 2017

I will deal with this problem as soon as possible.

@binsee

This comment has been minimized.

Show comment
Hide comment
@binsee

binsee Oct 2, 2017

Member

I made a mistake...
I'll re-send a new pr...

Member

binsee commented Oct 2, 2017

I made a mistake...
I'll re-send a new pr...

@binsee binsee closed this Oct 2, 2017

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Oct 2, 2017

Member

Ok. But it's always a good behavior to update one PR till be merged, because close and open a new PR will lose all the comments/reviews.

So I'd like to suggest you reopen this PR and keep updating this one. :)

Member

zixia commented Oct 2, 2017

Ok. But it's always a good behavior to update one PR till be merged, because close and open a new PR will lose all the comments/reviews.

So I'd like to suggest you reopen this PR and keep updating this one. :)

@binsee

This comment has been minimized.

Show comment
Hide comment
@binsee

binsee Oct 2, 2017

Member

@zixia new pr: #842

I am wrongly merge the master branch, and the change record is very large, which will lead to the review becomes more difficult.

Use the latest code to cover the pr branch, I do not know what will lead to the results?

Member

binsee commented Oct 2, 2017

@zixia new pr: #842

I am wrongly merge the master branch, and the change record is very large, which will lead to the review becomes more difficult.

Use the latest code to cover the pr branch, I do not know what will lead to the results?

@binsee binsee reopened this Oct 2, 2017

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Oct 2, 2017

Member

After you sync with the master branch, I suggest you do a git rebase to rebase your PR on the top of the latest changes.

Then I believe this PR will be ok again.

Could you have a try with git rebase and git push?

Member

zixia commented Oct 2, 2017

After you sync with the master branch, I suggest you do a git rebase to rebase your PR on the top of the latest changes.

Then I believe this PR will be ok again.

Could you have a try with git rebase and git push?

fix(*): Support for send 25Mb+ files
1. Upload a file larger than 25Mb.
2. Limit the upload file to no more than 100Mb.
3. According to webwxapp perfect upload processing.
4. Increase the upload and handling of upload exceptions.

binsee added some commits Sep 2, 2017

refactor(*): add support download file and send it again
1. add MediaMessage.saveFile() , used to save attachment
2. Refactor MediaMessage.forward(), support send to Room and Contact
array, add support download big file and send it again.
fix(message): Remove support for foward 25Mb+ files in forward()
Because webWx restrictions, more than 25 MB of files can not be
downloaded, it can not be forwarded.
@binsee

This comment has been minimized.

Show comment
Hide comment
@binsee

binsee Oct 2, 2017

Member

@zixia Success, thanks for the reminder.

Member

binsee commented Oct 2, 2017

@zixia Success, thanks for the reminder.

@@ -461,7 +539,7 @@ export class PuppetWeb extends Puppet {
mediatype,
uploadmediarequest: JSON.stringify(uploadMediaRequest),
webwx_data_ticket: webwxDataTicket,
pass_ticket: passTicket,
pass_ticket: passTicket || '',

This comment has been minimized.

@binsee

binsee Oct 2, 2017

Member

After testing, this parameter is not required when uploading a file.

@binsee

binsee Oct 2, 2017

Member

After testing, this parameter is not required when uploading a file.

This comment has been minimized.

@binsee

binsee Oct 2, 2017

Member

fix #777

@binsee

binsee Oct 2, 2017

Member

fix #777

* It should be noted that when forwarding ATTACH type message, if the file size is greater than 25Mb, the forwarding will fail.
* The reason is that the server shields the web wx to download more than 25Mb files with a file size of 0.
*
* But if the file is uploaded by you using wechaty, you can forward it.

This comment has been minimized.

@binsee

binsee Oct 2, 2017

Member

Note that this is a new feature that supports forwarding your own uploaded 25Mb + files.

@binsee

binsee Oct 2, 2017

Member

Note that this is a new feature that supports forwarding your own uploaded 25Mb + files.

*
* ```javasrcipt
* .on('message', async m => {
* if (m.self() && m.rawObj && m.rawObj.Signature) {

This comment has been minimized.

@binsee

binsee Oct 2, 2017

Member

Here is the code to forward the 25mb+ file.

@binsee

binsee Oct 2, 2017

Member

Here is the code to forward the 25mb+ file.

@zixia

Thanks for the awesome fix!

Please let me know when you have been ready for merging.

Show outdated Hide outdated src/message.ts
Show outdated Hide outdated src/message.ts
Show outdated Hide outdated src/message.ts

binsee added some commits Oct 2, 2017

@binsee

This comment has been minimized.

Show comment
Hide comment
@binsee

binsee Oct 2, 2017

Member

@zixia
There is no other need to modify the place, you can merge.
Thanks!

Member

binsee commented Oct 2, 2017

@zixia
There is no other need to modify the place, you can merge.
Thanks!

@zixia zixia merged commit 4320003 into Chatie:master Oct 2, 2017

5 of 6 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
ci/circleci Your tests passed on CircleCI!
Details
codeclimate All good!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
coverage/coveralls First build on master at 54.077%
Details
security/snyk No new issues
Details
@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Oct 2, 2017

Member

Fantastic! Thank you for the great work!

Member

zixia commented Oct 2, 2017

Fantastic! Thank you for the great work!

@binsee binsee deleted the binsee:send-25mb-file branch Oct 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment