if i compile a greasemonkey script into an xpi, then can that xpi access to local file to read and write files from hard disk???
question 2, if i save data using SetValue API of GM then do i need to del the value or does it gets deleted automatically when i restart the FireFox browser??
if i compile a greasemonkey script into an xpi, then can that xpi access to local file to read and write files from hard disk???
yes it could, because it is then a firefox extension, but it would mean that you need to decompress the xpi file, and modify the code to access the file system.
question 2, if i save data using SetValue API of GM then do i need to del the value or does it gets deleted automatically when i restart the FireFox browser??
If you create a value then it will remain until you delete the value, regardless of browser restarts.
Related
I'm creating a local data store in node js and it will create a json file in a specific location
I want that file to be used by only one client at any given time if another client tries to access the same file then it should throw error, everything happens locally in the computer
Sounds like you want to implement a lock. If you don't know what it is I'd recommend reading about it.
If it's just a pet project, create an object that's responsible for opening and closing a file. It can have some internal state that indicates if file is currently used.
I wrote a script that is using slack API to parse AWS S3 files looking for strings or samples. As this is in testing, I'm using my local machine and ngrok to forward localhost traffic.
The thing is that the generated files are getting stores in my machine and will be stored in server once the script is ready for production.
Ideally, I'd like to avoid users needing to grab files from server. Do you think it's possible to store directly in user local machine?
No. Slack does not allow you to access the local machine of their users through a Slack app / API.
Solution 1: Download via browser
The easiest solution would be to offer a direct download link in a Slack message, e.g. via a Link button. Once the user clicks it he is prompted to download the file to his local machine.
Here is an example from one of my apps:
And once you click it you get this window:
To enable downloading via browser you need to set appropriate headers and send the file contents to the browser.
One approach is to have a helper script for the actual download and include a link to the helper script in the link button (you may also want to include some parameters in the link that defines what which file is downloaded).
The helper script then does the following:
Fetch the file to be downloaded (e.g. an PNG image)
Set headers to enable downloading via browser
Send the file to the browser
Here is an example in PHP:
<?php
$filename = "demo.png";
$file = file_get_contents($filename);
header('Content-Disposition: attachment;filename=' . $filename);
header('Content-Type: image/png');
echo $file;
die();
For more infos on download headers see also this answer on SO.
Solution 2: Upload to Slack
Alternatively you could upload the file to the user's Slack workspace via file.upload API method. That way the user does not need to download anything and and you can remove the file from your server after your app has finished processing.
I have finished with developing main mechanism of my Chrome Extension but I need to do final step and enable saving informations that extension gets. I already saw that chrome.fileSystem API allows this but it can't be used with extensions and using chrome.storage isn't posibble in this case because of lot of data. Is it posibble to somehow save all of that informations to .json file in extension and retrieve it when user wants?
If you are looking for unlimited storage, you first need to add the "unlimitedStorage"-Permission to your manifest file.
Then you can choose one of the following storage options:
chrome.storage.local
IndexedDB
File System (chrome only)
App Cache
WebSQL (deprecated)
More Info
https://developer.chrome.com/extensions/storage
https://developer.chrome.com/apps/offline_storage
https://developer.chrome.com/extensions/manifest/storage
https://github.com/summera/chromestore.js
Currently I'm working on a web project (Classic Asp) and I'm going to make an upload form.
Folklore says:
"Don't use the real name to save the uploaded files"
.
What are the problems, dangers, from the security point of view ?
Proper directory permissions should stop most of this stuff but I suppose for file names a potential danger is that they could name it something like "../Default.asp" or "../Malware.asp" or some other malicious path attempting to overwrite files and/or have an executable script on your server.
If I'm using a single upload folder, I always save my users uploads with a GUID file name just because users aren't very original and you get name conflicts very often otherwise.
One process (Twonky – DLNA server) check directory for files to feed them on demand through DLNA to TV. When I put to this directory .mpeg file Twonky updates it's database.
I want to put into directory something like file but when it will be accessed by Twonky to feed it's content to TV feed content stream from internet.
It will be brilliant if that will be shell-programmable solution but c programming is welcome too.
If you are looking to make some http content visible as a local file, you might want to check something like fuse's httpfs.
You might also look at using a FIFO.