Moralis - How to programmatically reset local chain? - moralis

Is there a way to programmatically reset the local chain rather than going through the UI.
I have looked through the Moralis docs and Googled but cant find any reference to it.
Any pointers?

Related

Google Drive API permission to children files

We would like access to a client’s folder within their Google Drive and all files under that folder. This can either be a folder we create from the app or a folder the client picks.
The first approach I tried was to create the folder from the app.
The problem is that I am only able to list the folder itself, but NONE of the content. https://developers.google.com/drive/api/v3/folder
The second approach was to use the Google Picker API. There the
client can choose which folder(s) to give us access to. However we
can only get access to the folder, and none of the children
folders/files. https://developers.google.com/picker/docs
This seemed like an easy and straightforward use case. But can’t seem to find a solution in their documentation, or maybe I don’t comprehend some of the logic. A solution would be a way to either propagate the permission to all the files included in the folder it get’s picked or created… or to have the picker select all the children.

My preference is to continue with the Recommended scope https://www.googleapis.com/auth/drive.file . And it might be that the folder contains thousands of individual files multiple levels in, so it’s not a solution to manually pick the files. Any thoughts on this would be greatly appreciated, thank you!
A possible solution for your situation...
Is to create the folder in a shared drive.
Therefore, even though new files are added/updated/removed you will still be able to see all the updates and retrieve the information needed as you will have constant access to this folder.
Another solution which is more cumbersome...
Is to ask for user's permission and to re-authorize the application each time they are using it so in the case a new file is added you will have access to it.
Reference
Drive API v3 shared drives;
Drive API v3 manage shared drives.
The first approach I tried was to create the folder from the app. The problem is that I am only able to list the folder itself, but NONE of the content. https://developers.google.com/drive/api/v3/folder
The issue is probably the scope you authorized the user with. If you authorized with read only access your not going to be able to create you need full drive access to do that.
If you are using https://www.googleapis.com/auth/drive.file then you should create a folder with that and then create a file in the folder that i believe should work.
The second approach was to use the Google Picker API. There the client can choose which folder(s) to give us access to. However we can only get access to the folder, and none of the children folders/files. https://developers.google.com/picker/docs
There is no way to request access for a single folder or files. Its all or nothing really unless you use the https://www.googleapis.com/auth/drive.file scope which would only give you access to the files that your application created.

Block downloads from Google Drive Api

Currently I am working on a project where it's next feature it's to block downloads on demand for a specific file/folder via API. The problem is that, I am not able to find that functionality in the docs.
There are Permissions to change, but neither of the options are to block downloads. I also discovered an attribute called capabilities.CanDownload, but unfortunately is none writable attr. I kept searching but I found nothing.
I was wondering is someone had the same issue and resolved it.
Thanks
From the user interface you can see that download permissions can be disabled for readers and commenters:
To achieve the same with the Drive API, you need to use the method Files:update and set the property copyRequiresWriterPermission to true

How to pre-authorize URL to use microphone in Electron (or Chrome)?

I need to pre-authorize a URL to use microphone. It's an internal system accessed via Electron (v4.1.3).
Pre-authorization is required as users use it in some sort of Linux thin client. That is, each day the system bootstrap from an image and then profiles,etc are created. Therefore users would have to click Yes on the access prompt every single day, and if hitting NO just causing headaches to provide them steps to fix as the system requires mic/audio.
I've checked Google Chrome, and apparently it writes the permission on {chrome_profile_dir}\Default\Preferences file.
But on Electron, could not see same behavior on AppData\Roaming\{app.name}\Preferences file. So, to be honest I don't even know where Electron is storing the permission. I deleted the aforementioned folder, but it doesn't ask permission anymore.
Is there a way, like writing to a preference file, I could pre-authorize this? If yes, would write that to the image file.
You could use permission request handlers in electron.
https://electronjs.org/docs/api/session#sessetpermissionrequesthandlerhandler

What's the proper place to put app configurations for gmail addon?

For a gmail add-on we are developing we need to be able to put different API url's for development vs. production, along with some other configurations. What would be the proper place to put these configurations and how to read them? I saw we can add script properties from Project Properties window and i am guessing we can read them using PropertiesService, but the problem is how can we have different configurations based on environment.
Any ideas?
As you said, store them in the Properties Service, specifically, the Script Properties. You can still access them and modify them after you publish.

Calling a Google Drive SDK from Google App Script application

i have been going around in circles here and have totally confused myself. I need some help.
I am (trying to) writing an application for a client that in concept is simple. he want a google write document with a button. the google drive account has several folders, each shared with several people. when he drops a new file in one of the folders, he wants to be able to open this write file, this file is the template for his email. he clicks the button, the system calls the changes service in the Google Drive SDK https://developers.google.com/drive/manage-changes, gets the list of files that have been added since the last time it was checked, then pull the list of people that the file has been shared with, and use the write file as a template to send that list of people an email saying their file is ready.
SO, easy enough, right?
I started by looking at the built in functions in the Google App Script API. I found this method, https://developers.google.com/apps-script/class_docslist#find in the DocsList class. problem is the description for the query simply says "the query string". So at first i tried the Drive SDK query parameters, which are
var files = DocsList.find("modifiedDate > 2012-12-20T12:00:00-08:00.");
it didn't work. that leads me to believe it is a simple full text search on the content. Thats not good enough.
That lead me into trying to call a Drive SDK method from within an App Script application. Great, we need an OLap 2 authentication. easy enough. found the objects in the script reference and hit my wall.
Client ID and Client Secret.
you see, when i create what this really is, a service account, the olap control in apps script doesn't know how to handle the encrypted json and pass it back and forth. Then when i tried to create and use an installed applications key, i get authentication errors because the controls again, don't know what to do with the workflow. and finally, when i try to create a web app key, i can't because i don't have the site host name or redirect URI. And i can't use the application key ability because since im working with files OLap 2 is required.
i used the anonymous olap for a while, but hit the limit of anonymous calls per day in the effort of trying to figure out the code a bit, thats not going to work because the guy is going to be pushing this button constantly thru the day.
i have been pounding my head on the desk over this for 5 hours now. i need some help here, can anyone give me a direction to go?
PS, yes, i know i can use the database controls and load the entire list of files into memory and compare it to the list of files in the database. problem being, we are talking tens of thousands of files. bad idea.
I wouldn't use DocsList anymore - DriveApp is supposed to be a more reliable replacement. Some of the commands have changed, so instead of find, use searchFiles. This should work more effectively (they even use a query like yours as an example).