Get SHA256 hash for Visual Studio Code installer file programmatically - visual-studio-code

Is there a web API (or otherwise) which would allow an automatic downloader script to fetch vscode installer's SHA256 hash, for any version of vscode including the latest?
This would allow the script to verify the downloaded files automatically by comparing the hashes.
The hashes, for the latest version only, are currently shown in the bottom of the download page in a folded mode (i.e. it needs to be expanded for the browser to fetch the hashes and show them). This doesn't present an easy way for an automatic script to fetch them.
Thanks

Whilst this doesn't allow you to get the hashes for any version, it would allow an automated script to fetch and work with the latest version hashes.
You can get a JSON file of the hashes and other file/version information from https://code.visualstudio.com/sha?build=stable. This can be put through a JSON parser to extract the data you need.

There was no available API for this so I raised a request to Microsoft and they implemented the following API, which gets the HASH as needed (along with other things).
https://update.code.visualstudio.com/api/versions/commit:COMMIT_ID(or version)/PLATFORM/QUALITY
Examples:
https://update.code.visualstudio.com/api/versions/1.56.0/win32-x64/stable
https://update.code.visualstudio.com/api/versions/commit:c7119ae8b6390a5700f6b28f0f1511d676c96562/win32-x64/insider
https://update.code.visualstudio.com/api/versions/commit:c7119ae8b6390a5700f6b28f0f1511d676c96562/darwin/insider
https://update.code.visualstudio.com/api/versions/commit:054a9295330880ed74ceaedda236253b4f39a335/darwin/stable
Example returned value:
{"url":"https://az764295.vo.msecnd.net/stable/cfa2e218100323074ac1948c885448fdf4de2a7f/VSCodeSetup-x64-1.56.0.exe","name":"1.56.0","version":"cfa2e218100323074ac1948c885448fdf4de2a7f","productVersion":"1.56.0","hash":"ab40232ae7fd669effe6c35ea34948349c273a11","timestamp":1620165132598,"sha256hash":"9719979567f6788bcddc675df29a028e995c2724b7a714280c1e14302c2d6faa","supportsFastUpdate":true}

Related

VS Code workspace storing additional script data

I wanna build external editor for scripts stored in crm.
I have API which exposes script engine returning list of scripts containing ,script id, script name, content...
Editor will be Visual Studio Code plus my extension. Manage to build extension and get data, store scripts on in the folder and give them name from the response. Problem is in update, to send data back to the server i need to use id not the name.
Question: is there any kind of container in workspace where i can store all data related to every script such as Id?
Something like settings for every script containing scriptName:id, date, owner...
Maybe https://code.visualstudio.com/api/extension-capabilities/common-capabilities#data-storage can help? You can store data either locally, in the workspace, or globally, in the user' storage space. Can be simple key/value pairs, or your own format.

Get names of files contained in Dropbox directory

I'm in need to read a large number of files from a permanent Dropbox webpage.
The reading part is fine, but I'm having troubles finding a way to list all the files contained within.
To be more precise, I would need something like
files = dir([url_to_Dropbox_directory,'*.file_extension']);
returning the names of all the files.
I've found an example in php, but nothing for MATLAB. Using dir was just an example, I'm looking for any solution to this problem.
How can I get the file list from a permanent Dropbox webpage?
You should use the Dropbox API where you can acces that data by a http request. "file-list-folder" is the specific endpoint that you are looking for.
Here is the documentation for it:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
In addition you could use the SDK for PHP (or others programming languages). I have used the SDK for JS and it's easy and works well.
PHP SDK:
https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/

Dropbox API integration with Microsoft Mail Merge

I am trying to pass values to be shown in fields inserted in Microsoft Word documents or be an overlay (what is the correct word). Can it be done?
You can't selectively modify portions of a file on Dropbox remotely using the API, if that's what you mean. The API only allows you to upload new entire new versions. So you can download the file, modify it as desired, and upload the new version

TFS 2013 build - uploading build output to servier via FTP

I'm hoping someone can help. I've started using the Community TFS Build Extensions, in particular the FTP activity. I followed the documentation here and got to grips with the it pretty easily. I'm encountering one major problem though.
My Web app has a basic enough structure:
I start by creating the FindMatchingFile activity which places the files in the drop location into an IEnumberable variable called FilesToFTP :
String.Format("{0}\**\*.*", BuildDetail.DropLocation)
When I iterate through the variable and print out the results, all seems correct:
G:\builds\Build.1203\CredentialManagement\bin\BusLogic.dll
G:\builds\Build.1203\CredentialManagement\css\style.css
G:\builds\Build.1203\CredentialManagement\AppError.aspx
......
G:\builds\Build.1203\CredentialManagement\Web.config
etc etc.
The problem is, when I pass that IEnumerable to the Ftp activity (converting it to a string array), it FTP uploads all the files on the server however it doesn't keep the directory structure of my Web app. It just piles all the output (dlls, aspx etc) into one directory. See the following two screenshots.
Is there any way I can use the FTP activity to upload all the output from the drop location recursively? I feel like I'm doing something simple wrong.
The FTP activity in TFS Build Extensions doesn't upload files recursively.
I think it would be a good value addition to the activity. Please create a request for the project and we will add in it. For now, you can go around it by calling the Ftp activity recursively for each directory and setting the RemoteDirectory for each.

how do I set a Thunderbird signature to use a dynamic url's html?

I want to use a dynamic email signature in Thunderbird, that is context aware (depends on date, events in db, etc.)
If I have a PHP that can generate the signature html (i.e. http://www.site.com/email_sign.php)
how do I force Thunderbird to use it?
(the only options I see are using static html (whether inline, of from a local system file).
any ideas?
You can use the Signature Switch add-on and a batch file calling wget to achieve what you want. I wrote a simple executable to replace the bat file; you can read about it (and download it if you want to) from http://www.else.co.nz/portfolio/020-code/dynamic-email-signatures
I doubt you can do this simply. Thunderbird does allow scripting via the creation of plugins but I wouldn't personally know how do do it or how easy it might be.
Best answer I can think of would be to set a scheduled task / cron job to download the php to a local file then follow the instructions in the knowledge base, namely:
You can use Thunderbird to create signature files, or you can use your operating system tools to create them—for example, a plain text editor.
Thunderbird does not provide any
special place to store signature
files. You could create a Signatures
directory in your profile to store
them, making them easy to back up
along with the rest of your profile.
Or you could store them somewhere
else.
To use a signature file, specify it in
Account Settings as the signature for
an identity. Check the box "Attach the
signature from a file instead" and
specify the signature file.
This will work unless Thunderbird caches the HTML internally, however I see no indication in the FAQ that this is the case.
For years I updated the signature for my email client manually – until I got fed up… That’s why I wrote a PHP script to create a randomized signature block automatically from an RSS feed! Check it out: https://github.com/birdy1976/signature :-D