Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
a55162b6b4
|
|||
|
10b5ccd0c4
|
|||
| b308e9fab6 | |||
| f8b806f3f4 | |||
| 47f908ff47 | |||
| 63987f8fa1 | |||
|
|
db0878bf44 | ||
|
|
a5289500cf | ||
|
220be8f732
|
@@ -10,11 +10,13 @@ platform:
|
||||
steps:
|
||||
- name: Setup
|
||||
commands:
|
||||
- git fetch origin --tags
|
||||
- make setup
|
||||
|
||||
- name: Test
|
||||
commands:
|
||||
- make test
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
@@ -31,15 +33,16 @@ platform:
|
||||
steps:
|
||||
- name: Setup
|
||||
commands:
|
||||
- git fetch origin --tags
|
||||
- make setup
|
||||
|
||||
- name: Build Release
|
||||
commands:
|
||||
- cd debian
|
||||
- make release
|
||||
- make build
|
||||
- make copy
|
||||
- make deploy
|
||||
- make tag
|
||||
trigger:
|
||||
event:
|
||||
- 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))
|
||||
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
|
||||
package docs
|
||||
import "net/http"
|
||||
@@ -27,8 +30,9 @@ run: $(BINARY)
|
||||
./$(BINARY) -vv serve
|
||||
|
||||
$(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:
|
||||
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 }
|
||||
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.right { float: right; }
|
||||
pre {background-color: #c8c8c8; color: black}
|
||||
pre { color: black}
|
||||
.breadcrumb label { color: black; }
|
||||
|
||||
.sidebar .list-group {
|
||||
|
||||
@@ -95,6 +95,8 @@ const PASTE_API = "https://paste.dn42.us/paste"
|
||||
|
||||
const syntaxItems = [
|
||||
["text", "Plain Text"],
|
||||
["markdown", "Markdown"],
|
||||
|
||||
["apache", "Apache"],
|
||||
["bash", "Bash"],
|
||||
["coffeescript", "CoffeeScript"],
|
||||
@@ -108,7 +110,6 @@ const syntaxItems = [
|
||||
["javascript", "JavaScript"],
|
||||
["json", "JSON"],
|
||||
["makefile", "Makefile"],
|
||||
["markdown", "Markdown"],
|
||||
["nginx", "Nginx"],
|
||||
["objectivec", "Objective C"],
|
||||
["perl", "Perl"],
|
||||
@@ -313,10 +314,10 @@ function PasteCreate({error, onSubmit, onChange, syntax, syntaxItems, expire, ex
|
||||
return (
|
||||
<section className="container">
|
||||
<div>
|
||||
{!!error ?
|
||||
<Alert bsStyle="warning">
|
||||
{!!error &&
|
||||
<Alert warning>
|
||||
<strong>Holy guacamole!</strong> {error}
|
||||
</Alert> : ""}
|
||||
</Alert>}
|
||||
|
||||
<Form name='paste' onSubmit={onSubmit}>
|
||||
<div className="form-inline">
|
||||
@@ -337,12 +338,15 @@ function PasteCreate({error, onSubmit, onChange, syntax, syntaxItems, expire, ex
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</Form>
|
||||
<br/>
|
||||
|
||||
<p>Create pastes from the command line! <a href='./paste.sh' download>paste.sh</a></p>
|
||||
<div className="card">
|
||||
<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:
|
||||
@@ -352,43 +356,54 @@ 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)`}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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' : '';
|
||||
return (
|
||||
<section className="container">
|
||||
<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>
|
||||
</span>
|
||||
<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>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div ng-if="store.err == undefined">
|
||||
<div className='well well-sm'>
|
||||
<b>Lang:</b> {syntax}, <b>Expires:</b> {expires}
|
||||
<br/>
|
||||
|
||||
<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 className="card-footer">
|
||||
<pre>{`# Command Line:
|
||||
curl -s "${PASTE_API}/${hash}" \\
|
||||
curl -s "${PASTE_API}/${hash}" \\
|
||||
| sed "1,/^\\$/d" \\
|
||||
| openssl aes-256-cbc -md md5 \\
|
||||
-d -a -k "${decryptKey}" ${gzipOpts}
|
||||
|
||||
${cipher}`}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ section.container { margin-bottom: 2em; }
|
||||
textarea { 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; }
|
||||
pre.grey { background-color: lightgrey; }
|
||||
|
||||
label { color: lightgrey; }
|
||||
|
||||
table a:link {
|
||||
color: #666;
|
||||
|
||||
27
debian/Makefile
vendored
27
debian/Makefile
vendored
@@ -1,42 +1,39 @@
|
||||
NAME=sour.is-paste
|
||||
VERSION:=$(shell cat VERSION)
|
||||
RELEASE:=$(shell cat RELEASE)
|
||||
VERSION:=$(shell ./inc_version.sh -p $(shell git describe --tags `git rev-list --tags --max-count=1`)|cut -b2-)
|
||||
DATE:=$(shell date -u +%FT%TZ)
|
||||
|
||||
REPO_HOST="xuu@kapha"
|
||||
ANSIBLE_HOST="kapha"
|
||||
REPO_PATH="/opt/web/pub/sour.is/debian/"
|
||||
|
||||
all: release build copy
|
||||
all: build copy tag
|
||||
|
||||
clean:
|
||||
rm -r BUILD/*
|
||||
|
||||
release:
|
||||
@echo "release version $(RELEASE)"
|
||||
@echo `expr $(RELEASE) + 1` > RELEASE
|
||||
git commit -am "release version $(VERSION)-$(RELEASE)"
|
||||
git tag -a -m "release version $(VERSION)-$(RELEASE)" "v$(VERSION)-$(RELEASE)"
|
||||
tag:
|
||||
git tag -a -m "release version $(VERSION)" "v$(VERSION)"
|
||||
git push --tags
|
||||
|
||||
build:
|
||||
export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
|
||||
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
||||
rm -rf ./$${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 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 \
|
||||
-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; \
|
||||
dpkg -b $${BUILD};
|
||||
|
||||
copy:
|
||||
export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
|
||||
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
||||
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:
|
||||
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
|
||||
}
|
||||
|
||||
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}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user