update UI and fixes

This commit is contained in:
Xuu 2020-08-31 12:35:59 -06:00
parent 220be8f732
commit 10b5ccd0c4
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
5 changed files with 121 additions and 103 deletions

View File

@ -1,9 +1,9 @@
body,html {color: #c8c8c8 !important; background-color: #272b30 !important; } body,html {color: black !important; background-color: #272b30 !important; }
header + section { padding-top: 52px; padding-bottom: 2.1em } header + section { padding-top: 52px; padding-bottom: 2.1em }
footer { background-color: #3e444c; position:fixed; bottom:0; width: 100%; height: 2em; border-top: 1px solid #bbb; padding: 4px } footer { background-color: #3e444c; position:fixed; bottom:0; width: 100%; height: 2em; border-top: 1px solid #bbb; padding: 4px }
footer span.left { float: left; } footer span.left { float: left; }
footer span.right { float: right; } footer span.right { float: right; }
pre {background-color: #c8c8c8; color: black} pre { color: black}
.breadcrumb label { color: black; } .breadcrumb label { color: black; }
.sidebar .list-group { .sidebar .list-group {

View File

@ -95,6 +95,8 @@ const PASTE_API = "https://paste.dn42.us/paste"
const syntaxItems = [ const syntaxItems = [
["text", "Plain Text"], ["text", "Plain Text"],
["markdown", "Markdown"],
["apache", "Apache"], ["apache", "Apache"],
["bash", "Bash"], ["bash", "Bash"],
["coffeescript", "CoffeeScript"], ["coffeescript", "CoffeeScript"],
@ -108,7 +110,6 @@ const syntaxItems = [
["javascript", "JavaScript"], ["javascript", "JavaScript"],
["json", "JSON"], ["json", "JSON"],
["makefile", "Makefile"], ["makefile", "Makefile"],
["markdown", "Markdown"],
["nginx", "Nginx"], ["nginx", "Nginx"],
["objectivec", "Objective C"], ["objectivec", "Objective C"],
["perl", "Perl"], ["perl", "Perl"],
@ -313,10 +314,10 @@ function PasteCreate({error, onSubmit, onChange, syntax, syntaxItems, expire, ex
return ( return (
<section className="container"> <section className="container">
<div> <div>
{!!error ? {!!error &&
<Alert bsStyle="warning"> <Alert warning>
<strong>Holy guacamole!</strong> {error} <strong>Holy guacamole!</strong> {error}
</Alert> : ""} </Alert>}
<Form name='paste' onSubmit={onSubmit}> <Form name='paste' onSubmit={onSubmit}>
<div className="form-inline"> <div className="form-inline">
@ -337,57 +338,71 @@ function PasteCreate({error, onSubmit, onChange, syntax, syntaxItems, expire, ex
</div> </div>
<textarea required className='form-control' rows='20' name="plain" onChange={onChange} value={plain}></textarea> <textarea required className='form-control' rows='20' name="plain" onChange={onChange} value={plain}></textarea>
<pre>Additional Entropy: {entropy} bytes / Content size: {blength(plain)} bytes</pre> <pre className="grey">Additional Entropy: {entropy} bytes / Content size: {blength(plain)} bytes</pre>
<Button type='submit' className='btn btn-default btn-lg btn-block'>Encrypt</Button> <Button type='submit' className='btn btn-default btn-lg btn-block'>Encrypt</Button>
</Form> </Form>
<br/>
<p>Create pastes from the command line! <a href='./paste.sh' download>paste.sh</a></p> <div className="card">
<pre>{`$ echo /etc/passwd | ./paste.sh <div className="card-body">
<p>Create pastes from the command line! <a href='/paste.sh' download>paste.sh</a></p>
<pre>{`$ echo /etc/passwd | ./paste.sh
env options: env options:
PASTE_URL - Set the url base for paste operations (default: HTTPS://paste.dn42.us) PASTE_URL - Set the url base for paste operations (default: HTTPS://paste.dn42.us)
PASTE_GZIP - 0 = No Compression, 1 = Use gzip compression (default: 0) PASTE_GZIP - 0 = No Compression, 1 = Use gzip compression (default: 0)
PASTE_BURN - 0 = No Burn on Read, 1 = Burn on read (default: 0) PASTE_BURN - 0 = No Burn on Read, 1 = Burn on read (default: 0)
PASTE_DATE - Value to be used when setting expire date. (default: next-week)`} PASTE_DATE - Value to be used when setting expire date. (default: next-week)`}
</pre> </pre>
</div>
</div>
</div> </div>
</section> </section>
); );
} }
function PasteView({hash, decryptKey, expires, gzip, cipher, plain, syntax, onNew, onCopy}) { function PasteView({hash, decryptKey, expires, burn, gzip, cipher, plain, syntax, onNew, onCopy}) {
const gzipOpts = gzip ? '| gzip -dc' : ''; const gzipOpts = gzip ? '| gzip -dc' : '';
return ( return (
<section className="container"> <section className="container">
<div className="input-group"> <div className="input-group">
<span className="input-group-btn"> <span className="input-group-prepend">
<button className="btn btn-default" type="button" onClick={onNew}>New</button> <button className="btn btn-default" type="button" onClick={onNew}>New</button>
</span> </span>
<input type='text' readOnly className='form-control' value={`${window.location.origin}/paste/#/${hash}!${decryptKey}`} onClick={(e) => e.target.select()}/> <input type='text' readOnly className='form-control' value={`${window.location.origin}/paste/#/${hash}!${decryptKey}`} onClick={(e) => e.target.select()}/>
<span className="input-group-btn"> <span className="input-group-append">
<button className="btn btn-default" type="button" onClick={onCopy}>Copy</button> <button className="btn btn-default" type="button" onClick={onCopy}>Copy</button>
</span> </span>
</div> </div>
<div ng-if="store.err == undefined"> <br/>
<div className='well well-sm'>
<b>Lang:</b> {syntax}, <b>Expires:</b> {expires} <div className="card">
<div className='card-header'>
<b>Lang:</b> {syntax}
&nbsp;
<b>Expires:</b> {expires}
&nbsp;
{burn && (<b> BURN ON READ </b>)}
</div>
<div className="card-body">
{syntax==="markdown" ? (
<Markdown source={plain} />
) : (
<Highlight className={syntax}>{plain}</Highlight>
)}
</div> </div>
{syntax==="markdown" ? (
<Markdown source={plain} />
) : (
<Highlight className={syntax}>{plain}</Highlight>
)}
<div className="card-footer">
<pre>{`# Command Line: <pre>{`# Command Line:
curl -s "${PASTE_API}/${hash}" \\ curl -s "${PASTE_API}/${hash}" \\
| sed "1,/^\\$/d" \\ | sed "1,/^\\$/d" \\
| openssl aes-256-cbc -md md5 \\ | openssl aes-256-cbc -md md5 \\
-d -a -k "${decryptKey}" ${gzipOpts} -d -a -k "${decryptKey}" ${gzipOpts}
${cipher}`}</pre> ${cipher}`}</pre>
</div>
</div> </div>
</section> </section>
); );

View File

@ -2,6 +2,9 @@ section.container { margin-bottom: 2em; }
textarea { font-family: "Fira Code",hack,"Anonymous Pro",monospace; } textarea { font-family: "Fira Code",hack,"Anonymous Pro",monospace; }
pre { font-family: "Fira Code",hack,"Anonymous Pro",monospace; } pre { font-family: "Fira Code",hack,"Anonymous Pro",monospace; }
code { font-family: "Fira Code",hack,"Anonymous Pro",monospace; } code { font-family: "Fira Code",hack,"Anonymous Pro",monospace; }
pre.grey { background-color: lightgrey; }
label { color: lightgrey; }
table a:link { table a:link {
color: #666; color: #666;
@ -98,5 +101,5 @@ table tr:last-child td:last-child {
table tr:hover td { table tr:hover td {
background: #f2f2f2; background: #f2f2f2;
background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0)); background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0));
background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0); background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0);
} }

View File

@ -254,7 +254,7 @@ func publicSwaggerJson() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "public/swagger.json", size: 4895, mode: os.FileMode(0644), modTime: time.Unix(1598654963, 0)} info := bindataFileInfo{name: "public/swagger.json", size: 4895, mode: os.FileMode(0644), modTime: time.Unix(1598898929, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x71, 0xcc, 0xe, 0x5f, 0xc1, 0xe9, 0xd6, 0xa9, 0x46, 0x93, 0xde, 0x3d, 0x71, 0x10, 0x7f, 0xa9, 0x1e, 0x98, 0x11, 0x70, 0xc6, 0xcf, 0x1c, 0xa, 0x57, 0x84, 0xfc, 0x3c, 0xf7, 0x28, 0x3, 0x67}} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x71, 0xcc, 0xe, 0x5f, 0xc1, 0xe9, 0xd6, 0xa9, 0x46, 0x93, 0xde, 0x3d, 0x71, 0x10, 0x7f, 0xa9, 0x1e, 0x98, 0x11, 0x70, 0xc6, 0xcf, 0x1c, 0xa, 0x57, 0x84, 0xfc, 0x3c, 0xf7, 0x28, 0x3, 0x67}}
return a, nil return a, nil
} }

File diff suppressed because one or more lines are too long