Mounting a workspace on external volume via REST API - eclipse-che

I am trying to create a new workspace in eclipse-che and I wish to mount an external NFS volume in the workspace container.
Can anyone point me to the API where I can give a workspace mount path ?.
Thanks.

There's no API for that, but you may grab host and port of a running workspace and then mount a volume.

You're looking for "Swagger" browse to <che-address>:<port>/swagger.
Once you're at this page go to, "Workspace" -> "get workspace users can read" -> "try it out!". The response body has a lot of JSON. I recommend ctrl+f for your workspace name eg: "wksp-foo". About 10 lines above your name you will see the key "id" with a 25 character alphanumeric string that starts with "worksp...".

Related

Microsoft Teams Action messaging extension with task module and URL not working

I am trying to build an action messaging extension with a task module implementation which uses a URL attribute to load the page. Attached is the screenshot of the task module code which was generated by Yeoman Teams generator.
The popup comes up blank. So it means it's not loading the HTML file path, but if I open Chrome and try to load the URL, it works fine.
Also instead of using URL if I use an adaptive card it works fine. Only the URL part doesn't load on the popup. Attached is another screenshot of the popup inside teams:
What could be wrong with the code?
The other answer is correct in that your url needs to be reflected 100% correctly in your manifest. However, there are a few things that you need to be clear on:
It's not per se the address of the BOT that's important, but rather the address of the web page itself that needs to be listed in your safe domains list in your manifest. In your case, they're hosted in the same endpoint, but they might not be in your final solution, depending on how you end up hosting this.
While you're developing locally, rather use App Studio. That way, you don't need to fiddle with the zip file every time - you can just change it in App Studio and immediately redeploy with the updated URL
Every time when you compile and run the project, a new hostname is generated since ngrok free license is used in the yo teams scaffolding, which makes the app to reference to the old URL.
You need to uninstall the app from the Teams app store under your organization and upload the new app from the package folder .zip (Only after gulp ngrok-serve)
If it still does not work, check the below
Unzip the package file and verify the manifest whether it's pointing to the right hostname of the action html page
Go to http://localhost:4040 to inspect the ngrok tunnel traffic that should give more info on the routed requests.

How Does Firebase App Distribution name distributions?

I was assuming Firebase App Distribution names distributions by the versionName. For me it displays empty value. There is only versionCode in brackets.
This is how it looks at firebase:
Does anyone know what is the distribution name and how to verify it? Which command line tool can I use to determine distribution name based on APK file? I am using dexguard obfuscation tool and I think it might be related. When I check versionName via aapt dump badging on the uploaded APK it shows me correct versionName. Don't know why Firebase displays empty value.
The name of the app distribution gets its value via your app's name that you've set in your code.

Google Drive MD5 checksum for files

I'm not a programmer, just a regular user of Google Drive. I want to see if the files are uploaded correctly. I go through a whole process in the OAuth 2.0 Playground that lists all files, shows the MD5 checksums but also lots of information per file. If I upload a new file it's hard to search for it and verify its md5 checksum.
Is there an easier way (through an app, maybe?) to show/list MD5 checksums for the uploaded files? I wonder why the Details pane doesn't have it, only lists the file size in bytes.
edit: NB these instructions have changed slightly for the v3 API
I've figured out a quick way to get the MD5 checksums of the files uploaded and decided to share it here, too. Log into your Google Drive account, then:
Visit: https://developers.google.com/drive/v3/reference/files/list
Scroll down to the Try it! section.
Change "Authorize requests using OAuth 2.0" from OFF to ON by clicking on it, then select:
https://www.googleapis.com/auth/drive.metadata.readonly
and click Authorize.
Choose your account then click Accept.
Fill in the fields field with:
for v2 API:
items(md5Checksum,originalFilename)
for v3 API:
open "Show standard parameters" in GUI to see fields than
files(md5Checksum,originalFilename)
to only get a list of filenames and MD5 checksums.
Click Execute and you'll open a list with all the files uploaded to Google Drive and their MD5 checksums.
API instructions
Google Developers - OAuth 2.0 Playground:
https://developers.google.com/oauthplayground/
Step 1: Select & authorize APIs:
Expand "Drive API v3".
Enable "https://www.googleapis.com/auth/drive.metadata.readonly".
Click "Authorize APIs".
Click "Allow".
Step 2: Exchange authorization code for tokens:
Click "Exchange authorization code for tokens".
Step 3: Configure request to API:
Enter the "Request URI".
Click "Send the request".
Request URI instructions
All files in folder
Get specific fields of files in a folder:
https://www.googleapis.com/drive/v3/files?q="folderId"+in+parents&fields=files(md5Checksum,+originalFilename)
//
Replace "folderId" with the folder ID.
You can use &fields=files(*) to get all of the file's fields.
Single file
Get specific fields of a file:
https://www.googleapis.com/drive/v3/files/fileId?fields=md5Checksum,+originalFilename
//
Replace "fileId" with the file ID.
You can use &fields=* to get all of the file's fields.
Parsing the JSON response
Open a JavaScript console.
Save the object into a variable.
Map the object.
Copy the result.
Code
var response = {
"files": [
{
"md5Checksum": "0cc175b9c0f1b6a831c399e269772661",
"originalFilename": "a.txt"
},
{
"md5Checksum": "92eb5ffee6ae2fec3ad71c777531578f",
"originalFilename": "b.txt"
}
]
};
var result = response.files.map(function (file) { return (file.md5Checksum + " *" + file.originalFilename); }).join("\r\n");
console.log(result);
copy(result);
Here are three additional, different ways to list md5 checksums.
Install Google Skicka, a command line tool for Google Drive and run skicka ls -ll /
Although the readme file says it's not an official google product it is hosted on google's github account, so I guess it can be trusted.
There is a plugin that lists all files with their checksums in drive's spreadsheet.
Here's my python3 script that I've created for myself. It's mostly copied from google's official examples. You'll need to obtain client_secret.json file and place it in the same directory with the script - here's the instruction how to do it.
Based on: Alex's above answer!
Click the link : https://developers.google.com/drive/v3/reference/files/list
Click the Try it now link in the middle.
( An active window appears in the middle )
Scroll down the left pane in the active window.
Under fields section on the left pane, fill
files(md5Checksum,originalFilename)
Now we will limit access scopes :
(i) leave the Google OAuth 2.0 selected & clear the box against API key.
(ii) Expand Show scopes under Google OAuth 2.0
(iii) Clear all the scopes but keep this one selected:
**https: //www.googleapis.com/auth/drive.metadata.readonly**
Now click EXECUTE in blue.
(A new Google Sign In Window will open)
Use that window to Sign in with the respective google account & click Allow to permit the Google APIs Explorer access files in your google drive.
It's done! A new window will open with the results in lower right code pane. It will
provide the names & md5Checksums for all the files in the respective google
drive account.
Click outside of the active window to close the window & close the Google Drive
API tab. Now you can sign out of the google account if you want!
Combined with XP1 and Alex guides to work in my scenario, to list MD5 for private folders that shared with me
-includeItemsFromAllDrives
-includeTeamDriveItems
-supportsAllDrives
-supportsTeamDrives
Request URI in OAuth 2.0 Playground
https://www.googleapis.com/drive/v3/files?q="folderID"+in+parents&includeItemsFromAllDrives=true&includeTeamDriveItems=true&supportsAllDrives=true&supportsTeamDrives=true&fields=files(md5Checksum%2CoriginalFilename)

How to restore websites in localhost

I am newbie in Composite, I already backup and download C1 websites (www.solve.sg), I also have installed (and working) Composite in localhost. So how to restore websites in localhost?.
I already used method to rename folder CompositesC1 to CompositesC1old, then extract and put extracted web in CompositeC1 folder at localhost but not working and gave me error.
Please help the right method how to read online backup websites and to read that at localhost
I dont know what Composite is, but you probably need to go back to your cPanel / backend of your webhost, dump the DB powering solve.sg and import that into your local instance.
Your hosting provider will probably have a tool called phpMyAdmin; go in there and find the 'Export' tab at the top of your DB and dump it out as a .sql file. You will then import that file into your local environment, probably also using phpMyAdmin.
You may also have to change around some of the settings files that show where your database is relative to your application.

Avoid google oauth2 client secret in code

I'm writing a small c program which connects to the google api via Oauth2.
Therefore I need to send a client secret to google.
I store this secret in my code, which I want to push to github, but how can I avoid to show my client secret to everybody who looks at my code?
use a configuration file where you'll store the API key... you have many options, the simplest being writing the key directly into the file, more sophisticated being using some kind of serializers (like json, xml, inifile etc...), the right option is up to you (usually, you'll want to serialize if you want to store several options in the file).
You can also set the key as a program argument, if you don't mind the key to be visible in the process list of your host.
And be sure not to push your already existing git history to git hub, but create a new repository, or all your previous patches (with the key) will be public ;)
Storing secret (and ideally any string literals) in code is wrong - store it in a resource (text) file and don't push it to Git.
If you are searching for where to find out your Client Secret for your Google Drive apss. then follow this step.
Go to your project
Click Credential.
After that you will get all the details about your project like client
id, redirect uri etc. But there you will click on button "Download
Jason" and after downloading a file you will get your CLIENT SECRET.
Please look at the picture.

Resources