Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] - Upload password on querystring #322

Open
mapperr opened this issue Nov 19, 2024 · 0 comments
Open

[Proposal] - Upload password on querystring #322

mapperr opened this issue Nov 19, 2024 · 0 comments

Comments

@mapperr
Copy link

mapperr commented Nov 19, 2024

Hi,

first of all thanks for PsiTranfer, is a very simple and awesome product.

I want to propose a possible enhancement: can we pass the upload password on querystring?

e.g.: https://psitransfer.mydomain.org/?up=my_upload_password

The case is:

I would like to enable other, selected and trusted, people to easily upload stuff on my psitransfer instance.
I can give the upload password by other means, but I would like to publish a link to my psitransfer instance that they can easily click and from which they can upload their stuff without input the password manually.
This way I can rotate password just by updating the link with the upload password in the querystring.

Make sense to you?

The following can be a possible patch (consider I suck at I'm not proficient in Vue):

diff --git a/app/src/Upload/store/config.js b/app/src/Upload/store/config.js
index 30a47c4..d8d881a 100644
--- a/app/src/Upload/store/config.js
+++ b/app/src/Upload/store/config.js
@@ -22,6 +22,14 @@ export default {
       return new Promise((resolve, reject) => {
         const xhr = new XMLHttpRequest();
         xhr.open('GET', 'config.json');
+
+        let uri = window.location.search.substring(1); 
+        let params = new URLSearchParams(uri);
+        let querystringUploadPass = params.get("up");
+
+        if (querystringUploadPass) {
+            state.uploadPass = querystringUploadPass;
+        }
         state.uploadPass && xhr.setRequestHeader('x-passwd', state.uploadPass);
         xhr.onload = () => {
           if(xhr.status === 200) {

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant