Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: keep binary in same place, update if needed#33

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jsjoeio merged 11 commits intomainfromjsjoeio/fix-binary-windows
Jan 20, 2023

Conversation

jsjoeio
Copy link
Contributor

@jsjoeiojsjoeio commentedJan 17, 2023
edited
Loading

Description

@deansheather filed a bug related to the Windows Firewall prompt coming up with every new binary (i.e. every time we downloadcoder to an updated version).

After some initial testing, it appears keeping the binary in the same place will make the prompt only appear on the first time.

Previous implementation kept the version in the path.

We decided to refactor things to add support forETag on the server and then use those changes on the client (aka in the extension).

This means now the client will tell the server "Here's the version I have. What should I do?" and send the appropriate headers.

Checklist

  • if needed, change path/name of location to not include version
  • if the binary exists, SHA1 it and use it as theIf-None-Match header in your request
  • Server Response changes
    • on 200 OK: move the binary on top of the old one
    • on 304 Not Modified: delete the temp file and use the old binary

Testing Plan

TBD

Fixes#23

Kira-Pilot reacted with hooray emoji
@jsjoeiojsjoeio changed the titlewipfix: keep binary in same place, update if neededJan 17, 2023
@jsjoeiojsjoeioforce-pushed thejsjoeio/fix-binary-windows branch from4caf765 tod06c873CompareJanuary 17, 2023 21:04
@jsjoeiojsjoeio self-assigned thisJan 17, 2023
@jsjoeio
Copy link
ContributorAuthor

What's the easiest way to test these changes locally@kylecarbs ?

Copy link
Member

@deansheatherdeansheather left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

oops meant to request changes

jsjoeio reacted with thumbs up emoji
@jsjoeiojsjoeio marked this pull request as ready for reviewJanuary 18, 2023 15:49
Copy link
Member

@deansheatherdeansheather left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

the logic seems OK but I haven't tested it

@jsjoeio
Copy link
ContributorAuthor

@deansheather re: testing

Let me make these changes, build to avsix then send to you via Slack to test

deansheather reacted with thumbs up emoji

@jsjoeio
Copy link
ContributorAuthor

I tested locally on macOS and something is off

image

Seems like it's trying to use the binary before it's done renaming it?

This removes the version from the binary path to ensure that the pathalways remains the same on OS's.This way, tools like Windows Firewall and macOS Firewill will onlyprompt for a security check on the first install but not subsequentinstalls.
This makes significant changes to the `fetchBinary` logic.First, it refactors a couple pieces of logic into methods on the`Storage` class to make the code more readable.Then it modifies the flow to first check if the binary is outdated. Ifit is, then it downloads the latest version.
@jsjoeiojsjoeioforce-pushed thejsjoeio/fix-binary-windows branch from36da848 to369a823CompareJanuary 18, 2023 16:32
@jsjoeio
Copy link
ContributorAuthor

jsjoeio commentedJan 18, 2023
edited
Loading

I'm going to try rebasing onmain and then rebuilding and testing again.

EDIT: same issue

@jsjoeio
Copy link
ContributorAuthor

I figured it out - I was trying torm the file aftermving and so it was failing because it couldn't remove a file that doesn't exist 🤦🏼‍♂️

This will build a `.vsix` file locally marked as a pre-release which ishandy for testing.
@jsjoeio
Copy link
ContributorAuthor

Tested locally and seems to work 👍🏼

image

This makes a couple new changes:- if 200, move old binPath to binPath.old-- try removing .old binary- on start, cleanUpOldBinaries
- catch all potential errors from `fs`- only rename binPath to old right before replacing with tempFile
This generates the Etag correctly using a readableStream and the appendsit to the headers. This also adds some logging around etag, binPath andstatus code.
@jsjoeio
Copy link
ContributorAuthor

@deansheather ready for a new review!

Copy link
Member

@deansheatherdeansheather left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good and works on Windows for me. The logic seems OK but I'm not a big typescript guy so someone else should approve too

jsjoeioand others added2 commitsJanuary 20, 2023 11:01
Co-authored-by: Dean Sheather <dean@deansheather.com>
Co-authored-by: Dean Sheather <dean@deansheather.com>
Copy link
Member

@Kira-PilotKira-Pilot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Really appreciate the comments you left!

jsjoeio reacted with heart emoji
@jsjoeiojsjoeio merged commitec4aa92 intomainJan 20, 2023
@jsjoeiojsjoeio deleted the jsjoeio/fix-binary-windows branchJanuary 20, 2023 22:44
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Kira-PilotKira-PilotKira-Pilot approved these changes

@deansheatherdeansheatherdeansheather approved these changes

@kylecarbskylecarbsAwaiting requested review from kylecarbs

Assignees

@jsjoeiojsjoeio

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Windows Firewall prompt on every new binary
3 participants
@jsjoeio@deansheather@Kira-Pilot

[8]ページ先頭

©2009-2025 Movatter.jp