Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
a55162b6b4
|
|||
|
10b5ccd0c4
|
|||
| b308e9fab6 | |||
| f8b806f3f4 | |||
| 47f908ff47 | |||
| 63987f8fa1 | |||
|
|
db0878bf44 | ||
|
|
a5289500cf | ||
|
220be8f732
|
@@ -10,11 +10,13 @@ platform:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup
|
- name: Setup
|
||||||
commands:
|
commands:
|
||||||
|
- git fetch origin --tags
|
||||||
- make setup
|
- make setup
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
commands:
|
commands:
|
||||||
- make test
|
- make test
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
@@ -31,16 +33,17 @@ platform:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup
|
- name: Setup
|
||||||
commands:
|
commands:
|
||||||
|
- git fetch origin --tags
|
||||||
- make setup
|
- make setup
|
||||||
|
|
||||||
- name: Build Release
|
- name: Build Release
|
||||||
commands:
|
commands:
|
||||||
- cd debian
|
- cd debian
|
||||||
- make release
|
|
||||||
- make build
|
- make build
|
||||||
- make copy
|
- make copy
|
||||||
- make deploy
|
- make deploy
|
||||||
|
- make tag
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- promote
|
- promote
|
||||||
...
|
...
|
||||||
|
|||||||
8
Makefile
8
Makefile
@@ -4,6 +4,9 @@ DOCS_ASSET=src/docs/bindata.go
|
|||||||
SOURCE=$(wildcard cmd/paste/*.go) $(filter-out src/routes/bindata.go, $(wildcard src/routes/*.go))
|
SOURCE=$(wildcard cmd/paste/*.go) $(filter-out src/routes/bindata.go, $(wildcard src/routes/*.go))
|
||||||
BINARY=paste
|
BINARY=paste
|
||||||
|
|
||||||
|
VERSION:=$(shell debian/inc_version.sh -p $(shell git describe --tags `git rev-list --tags --max-count=1`))
|
||||||
|
DATE:=$(shell date -u +%FT%TZ)
|
||||||
|
|
||||||
define DUMMY_BINDATA
|
define DUMMY_BINDATA
|
||||||
package docs
|
package docs
|
||||||
import "net/http"
|
import "net/http"
|
||||||
@@ -27,8 +30,9 @@ run: $(BINARY)
|
|||||||
./$(BINARY) -vv serve
|
./$(BINARY) -vv serve
|
||||||
|
|
||||||
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(DOCS_ASSET)
|
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(DOCS_ASSET)
|
||||||
go build "sour.is/x/paste/cmd/paste"
|
go build \
|
||||||
|
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)" \
|
||||||
|
"sour.is/x/paste/cmd/paste"
|
||||||
|
|
||||||
clean-ui:
|
clean-ui:
|
||||||
rm -rf $(ROUTE_ASSET) $(DOCS_ASSET)
|
rm -rf $(ROUTE_ASSET) $(DOCS_ASSET)
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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}
|
||||||
|
|
||||||
|
<b>Expires:</b> {expires}
|
||||||
|
|
||||||
|
{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>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
27
debian/Makefile
vendored
27
debian/Makefile
vendored
@@ -1,42 +1,39 @@
|
|||||||
NAME=sour.is-paste
|
NAME=sour.is-paste
|
||||||
VERSION:=$(shell cat VERSION)
|
VERSION:=$(shell ./inc_version.sh -p $(shell git describe --tags `git rev-list --tags --max-count=1`)|cut -b2-)
|
||||||
RELEASE:=$(shell cat RELEASE)
|
DATE:=$(shell date -u +%FT%TZ)
|
||||||
|
|
||||||
REPO_HOST="xuu@kapha"
|
REPO_HOST="xuu@kapha"
|
||||||
ANSIBLE_HOST="kapha"
|
ANSIBLE_HOST="kapha"
|
||||||
REPO_PATH="/opt/web/pub/sour.is/debian/"
|
REPO_PATH="/opt/web/pub/sour.is/debian/"
|
||||||
|
|
||||||
all: release build copy
|
all: build copy tag
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -r BUILD/*
|
rm -r BUILD/*
|
||||||
|
|
||||||
release:
|
tag:
|
||||||
@echo "release version $(RELEASE)"
|
git tag -a -m "release version $(VERSION)" "v$(VERSION)"
|
||||||
@echo `expr $(RELEASE) + 1` > RELEASE
|
|
||||||
git commit -am "release version $(VERSION)-$(RELEASE)"
|
|
||||||
git tag -a -m "release version $(VERSION)-$(RELEASE)" "v$(VERSION)-$(RELEASE)"
|
|
||||||
git push --tags
|
git push --tags
|
||||||
|
|
||||||
build:
|
build:
|
||||||
export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
|
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
||||||
rm -rf ./$${BUILD}; \
|
rm -rf ./$${BUILD}; \
|
||||||
cp -r ROOT "$${BUILD}"; \
|
cp -r ROOT "$${BUILD}"; \
|
||||||
sed -i'.tmp' "s_Version:.*_Version: $(VERSION)-$(RELEASE)_" "$${BUILD}/DEBIAN/control"
|
sed -i'.tmp' "s_Version:.*_Version: $(VERSION)_" "$${BUILD}/DEBIAN/control"
|
||||||
|
|
||||||
export DATE=`date -u +%FT%TZ`; \
|
export DATE=`date -u +%FT%TZ`; \
|
||||||
export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
|
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
||||||
env GOOS=linux GOARCH=amd64 go build -v -o $${BUILD}/opt/sour.is/bin/paste \
|
env GOOS=linux GOARCH=amd64 go build -v -o $${BUILD}/opt/sour.is/bin/paste \
|
||||||
-ldflags "-X main.AppVersion=$(VERSION)-$(RELEASE) -X main.AppBuild=$${DATE}"\
|
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)"\
|
||||||
sour.is/x/paste/cmd/paste; \
|
sour.is/x/paste/cmd/paste; \
|
||||||
dpkg -b $${BUILD};
|
dpkg -b $${BUILD};
|
||||||
|
|
||||||
copy:
|
copy:
|
||||||
export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
|
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
||||||
scp "$${BUILD}.deb" $(REPO_HOST):$(REPO_PATH); \
|
scp "$${BUILD}.deb" $(REPO_HOST):$(REPO_PATH); \
|
||||||
ssh $(REPO_HOST) -- $(REPO_PATH)scan.sh "$(REPO_PATH)$(NAME)_$(VERSION)-$(RELEASE).deb";
|
ssh $(REPO_HOST) -- $(REPO_PATH)scan.sh "$(REPO_PATH)$(NAME)_$(VERSION).deb";
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
ansible $(ANSIBLE_HOST) -u xuu -b -m apt -a "name=sour.is-paste update_cache=yes state=latest"
|
ansible $(ANSIBLE_HOST) -u xuu -b -m apt -a "name=sour.is-paste update_cache=yes state=latest"
|
||||||
|
|
||||||
.PHONY: clean release build copy # deploy
|
.PHONY: clean tag build copy deploy
|
||||||
|
|||||||
1
debian/RELEASE
vendored
1
debian/RELEASE
vendored
@@ -1 +0,0 @@
|
|||||||
19
|
|
||||||
52
debian/inc_version.sh
vendored
Executable file
52
debian/inc_version.sh
vendored
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Increment a version string using Semantic Versioning (SemVer) terminology.
|
||||||
|
|
||||||
|
# Parse command line options.
|
||||||
|
|
||||||
|
while getopts ":Mmp" Option
|
||||||
|
do
|
||||||
|
case $Option in
|
||||||
|
M ) major=true;;
|
||||||
|
m ) minor=true;;
|
||||||
|
p ) patch=true;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
|
version=$1
|
||||||
|
|
||||||
|
# Build array from version string.
|
||||||
|
|
||||||
|
a=( ${version//./ } )
|
||||||
|
|
||||||
|
# If version string is missing or has the wrong number of members, show usage message.
|
||||||
|
|
||||||
|
if [ ${#a[@]} -ne 3 ]
|
||||||
|
then
|
||||||
|
>&2 echo "usage: $(basename $0) [-Mmp] major.minor.patch"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increment version numbers as requested.
|
||||||
|
|
||||||
|
if [ ! -z $major ]
|
||||||
|
then
|
||||||
|
((a[0]++))
|
||||||
|
a[1]=0
|
||||||
|
a[2]=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z $minor ]
|
||||||
|
then
|
||||||
|
((a[1]++))
|
||||||
|
a[2]=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z $patch ]
|
||||||
|
then
|
||||||
|
((a[2]++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${a[0]}.${a[1]}.${a[2]}"
|
||||||
@@ -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
Reference in New Issue
Block a user