mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
connect-page:
* add sharex, ishare * change placeholder password from `pw` to `hunter2` * add a button to use a real password instead of a placeholder
This commit is contained in:
parent
9e542cf86b
commit
278258ee9f
|
@ -4568,12 +4568,12 @@ class HttpCli(object):
|
|||
else self.conn.hsrv.nm.map(self.ip) or host
|
||||
)
|
||||
# safer than html_escape/quotep since this avoids both XSS and shell-stuff
|
||||
pw = re.sub(r"[<>&$?`\"']", "_", self.pw or "pw")
|
||||
pw = re.sub(r"[<>&$?`\"']", "_", self.pw or "hunter2")
|
||||
vp = re.sub(r"[<>&$?`\"']", "_", self.uparam["hc"] or "").lstrip("/")
|
||||
pw = pw.replace(" ", "%20")
|
||||
vp = vp.replace(" ", "%20")
|
||||
if pw in self.asrv.sesa:
|
||||
pw = "pwd"
|
||||
pw = "hunter2"
|
||||
|
||||
html = self.j2s(
|
||||
"svcs",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<meta name="theme-color" content="#{{ tcolor }}">
|
||||
<link rel="stylesheet" media="screen" href="{{ r }}/.cpr/splash.css?_={{ ts }}">
|
||||
<link rel="stylesheet" media="screen" href="{{ r }}/.cpr/ui.css?_={{ ts }}">
|
||||
<style>ul{padding-left:1.3em}li{margin:.4em 0}</style>
|
||||
<style>ul{padding-left:1.3em}li{margin:.4em 0}.txa{float:right;margin:0 0 0 1em}</style>
|
||||
{{ html_head }}
|
||||
</head>
|
||||
|
||||
|
@ -31,11 +31,12 @@
|
|||
<br />
|
||||
<span class="os win lin mac">placeholders:</span>
|
||||
<span class="os win">
|
||||
{% if accs %}<code><b>{{ pw }}</b></code>=password, {% endif %}<code><b>W:</b></code>=mountpoint
|
||||
{% if accs %}<code><b id="pw0">{{ pw }}</b></code>=password, {% endif %}<code><b>W:</b></code>=mountpoint
|
||||
</span>
|
||||
<span class="os lin mac">
|
||||
{% if accs %}<code><b>{{ pw }}</b></code>=password, {% endif %}<code><b>mp</b></code>=mountpoint
|
||||
{% if accs %}<code><b id="pw0">{{ pw }}</b></code>=password, {% endif %}<code><b>mp</b></code>=mountpoint
|
||||
</span>
|
||||
<a href="#" id="setpw">use real password</a>
|
||||
</p>
|
||||
|
||||
|
||||
|
@ -235,6 +236,44 @@
|
|||
|
||||
|
||||
|
||||
<div class="os win">
|
||||
<h1>ShareX</h1>
|
||||
|
||||
<p>to upload screenshots using ShareX <a href="https://github.com/ShareX/ShareX/releases/tag/v12.4.1">v12</a> or <a href="https://getsharex.com/">v15+</a>, save this as <code>copyparty.sxcu</code> and run it:</p>
|
||||
|
||||
<pre class="dl" name="copyparty.sxcu">
|
||||
{ "Name": "copyparty",
|
||||
"RequestURL": "http{{ s }}://{{ ep }}/{{ rvp }}",
|
||||
"Headers": {
|
||||
{% if accs %}"pw": "<b>{{ pw }}</b>",{% endif %}
|
||||
"accept": "url"
|
||||
},
|
||||
"DestinationType": "ImageUploader, TextUploader, FileUploader",
|
||||
"FileFormName": "f" }
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="os mac">
|
||||
<h1>ishare</h1>
|
||||
|
||||
<p>to upload screenshots using <a href="https://isharemac.app/">ishare</a>, save this as <code>copyparty.iscu</code> and run it:</p>
|
||||
|
||||
<pre class="dl" name="copyparty.iscu">
|
||||
{ "Name": "copyparty",
|
||||
"RequestURL": "http{{ s }}://{{ ep }}/{{ rvp }}",
|
||||
"Headers": {
|
||||
{% if accs %}"pw": "<b>{{ pw }}</b>",{% endif %}
|
||||
"accept": "json"
|
||||
},
|
||||
"ResponseURL": "{{ '{{fileurl}}' }}",
|
||||
"FileFormName": "f" }
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<a href="#" id="repl">π</a>
|
||||
<script>
|
||||
|
|
|
@ -15,6 +15,21 @@ for (var a = 0; a < oa.length; a++) {
|
|||
oa[a].innerHTML = html.replace(rd, '$1').replace(/[ \r\n]+$/, '').replace(/\r?\n/g, '<br />');
|
||||
}
|
||||
|
||||
function add_dls() {
|
||||
oa = QSA('pre.dl');
|
||||
for (var a = 0; a < oa.length; a++) {
|
||||
var an = 'ta' + a,
|
||||
o = ebi(an) || mknod('a', an, 'download');
|
||||
|
||||
oa[a].setAttribute('id', 'tx' + a);
|
||||
oa[a].parentNode.insertBefore(o, oa[a]);
|
||||
o.setAttribute('download', oa[a].getAttribute('name'));
|
||||
o.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(oa[a].textContent));
|
||||
clmod(o, 'txa', 1);
|
||||
}
|
||||
}
|
||||
add_dls();
|
||||
|
||||
|
||||
oa = QSA('.ossel a');
|
||||
for (var a = 0; a < oa.length; a++)
|
||||
|
@ -40,3 +55,21 @@ function setos(os) {
|
|||
}
|
||||
|
||||
setos(WINDOWS ? 'win' : LINUX ? 'lin' : MACOS ? 'mac' : 'idk');
|
||||
|
||||
|
||||
ebi('setpw').onclick = function (e) {
|
||||
ev(e);
|
||||
modal.prompt('password:', '', function (v) {
|
||||
if (!v)
|
||||
return;
|
||||
|
||||
var pw0 = ebi('pw0').innerHTML,
|
||||
oa = QSA('b');
|
||||
|
||||
for (var a = 0; a < oa.length; a++)
|
||||
if (oa[a].innerHTML == pw0)
|
||||
oa[a].textContent = v;
|
||||
|
||||
add_dls();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue