Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b308e9fab6 | |||
| f8b806f3f4 | |||
| 47f908ff47 | |||
| 63987f8fa1 | |||
|
|
db0878bf44 | ||
|
|
a5289500cf | ||
|
220be8f732
|
|||
|
4659727d3a
|
|||
|
67c9c41a24
|
|||
|
41924fbd8b
|
|||
|
a337ad4dae
|
|||
|
8c81e826cd
|
|||
|
e9d4869906
|
@@ -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
|
||||
|
||||
11
Makefile
11
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,9 +30,13 @@ 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"
|
||||
|
||||
build-ui: $(ROUTE_ASSET) $(DOCS_ASSET)
|
||||
clean-ui:
|
||||
rm -rf $(ROUTE_ASSET) $(DOCS_ASSET)
|
||||
build-ui: clean-ui $(ROUTE_ASSET) $(DOCS_ASSET)
|
||||
$(ROUTE_ASSET):
|
||||
cd assets; \
|
||||
rm -rf build ../public; \
|
||||
|
||||
183
assets/package-lock.json
generated
183
assets/package-lock.json
generated
@@ -1402,25 +1402,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz",
|
||||
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
|
||||
},
|
||||
"@popperjs/core": {
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.4.4.tgz",
|
||||
"integrity": "sha512-1oO6+dN5kdIA3sKPZhRGJTfGVP4SWV6KqlMOwry4J3HfyD68sl/3KmG7DeYUzvN+RbhXDnv/D8vNNB8168tAMg=="
|
||||
},
|
||||
"@restart/context": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@restart/context/-/context-2.1.4.tgz",
|
||||
"integrity": "sha512-INJYZQJP7g+IoDUh/475NlGiTeMfwTXUEr3tmRneckHIxNolGOW9CTq83S8cxq0CgJwwcMzMJFchxvlwe7Rk8Q=="
|
||||
},
|
||||
"@restart/hooks": {
|
||||
"version": "0.3.25",
|
||||
"resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.3.25.tgz",
|
||||
"integrity": "sha512-m2v3N5pxTsIiSH74/sb1yW8D9RxkJidGW+5Mfwn/lHb2QzhZNlaU1su7abSyT9EGf0xS/0waLjrf7/XxQHUk7w==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.15",
|
||||
"lodash-es": "^4.17.15"
|
||||
}
|
||||
},
|
||||
"@svgr/babel-plugin-add-jsx-attribute": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-4.2.0.tgz",
|
||||
@@ -1567,11 +1548,6 @@
|
||||
"@babel/types": "^7.3.0"
|
||||
}
|
||||
},
|
||||
"@types/classnames": {
|
||||
"version": "2.2.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/classnames/-/classnames-2.2.10.tgz",
|
||||
"integrity": "sha512-1UzDldn9GfYYEsWWnn/P4wkTlkZDH7lDb0wBMGbtIQc9zXEQq7FlKBdZUn6OBqD8sKZZ2RQO2mAjGpXiDGoRmQ=="
|
||||
},
|
||||
"@types/color-name": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
|
||||
@@ -1591,11 +1567,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/invariant": {
|
||||
"version": "2.2.33",
|
||||
"resolved": "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.33.tgz",
|
||||
"integrity": "sha512-/jUNmS8d4bCKdqslfxW6dg/9Gksfzxz67IYfqApHn+HvHlMVXwYv2zpTDnS/yaK9BB0i0GlBTaYci0EFE62Hmw=="
|
||||
},
|
||||
"@types/istanbul-lib-coverage": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz",
|
||||
@@ -1638,43 +1609,16 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
|
||||
"integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA=="
|
||||
},
|
||||
"@types/prop-types": {
|
||||
"version": "15.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz",
|
||||
"integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw=="
|
||||
},
|
||||
"@types/q": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz",
|
||||
"integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug=="
|
||||
},
|
||||
"@types/react": {
|
||||
"version": "16.9.46",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.46.tgz",
|
||||
"integrity": "sha512-dbHzO3aAq1lB3jRQuNpuZ/mnu+CdD3H0WVaaBQA8LTT3S33xhVBUj232T8M3tAhSWJs/D/UqORYUlJNl/8VQZg==",
|
||||
"requires": {
|
||||
"@types/prop-types": "*",
|
||||
"csstype": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"@types/react-transition-group": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.0.tgz",
|
||||
"integrity": "sha512-/QfLHGpu+2fQOqQaXh8MG9q03bFENooTb/it4jr5kKaZlDQfWvjqWZg48AwzPVMBHlRuTRAY7hRHCEOXz5kV6w==",
|
||||
"requires": {
|
||||
"@types/react": "*"
|
||||
}
|
||||
},
|
||||
"@types/stack-utils": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
|
||||
"integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw=="
|
||||
},
|
||||
"@types/warning": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/warning/-/warning-3.0.0.tgz",
|
||||
"integrity": "sha1-DSUBJorY+ZYrdA04fEZU9fjiPlI="
|
||||
},
|
||||
"@types/yargs": {
|
||||
"version": "13.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.10.tgz",
|
||||
@@ -2878,6 +2822,20 @@
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.5.2.tgz",
|
||||
"integrity": "sha512-vlGn0bcySYl/iV+BGA544JkkZP5LB3jsmkeKLFQakCOwCM3AOk7VkldBz4jrzSe+Z0Ezn99NVXa1o45cQY4R6A=="
|
||||
},
|
||||
"bootstrap-4-react": {
|
||||
"version": "0.0.59",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap-4-react/-/bootstrap-4-react-0.0.59.tgz",
|
||||
"integrity": "sha512-j3a618tWHl/ajYQi6zn0LdVfksRH+gyQ4RwIanTPin6xkHkgYfk+47ZlHFSwyiO9zVFn4xznoGjTwWA0AIlJkA==",
|
||||
"requires": {
|
||||
"bootstrap-4-required": "0.0.1",
|
||||
"fsts": "0.0.44"
|
||||
}
|
||||
},
|
||||
"bootstrap-4-required": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap-4-required/-/bootstrap-4-required-0.0.1.tgz",
|
||||
"integrity": "sha512-4S6Trn9pRVSR756GRYr3hy2cZL3Vc0tw0/H9E+mbNeOR+4tn6CeRgcLx0YqZmL2XlabtEV73+XAesmwkgTDKvQ=="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
@@ -3337,11 +3295,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"classnames": {
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz",
|
||||
"integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q=="
|
||||
},
|
||||
"clean-css": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.3.tgz",
|
||||
@@ -4056,11 +4009,6 @@
|
||||
"cssom": "0.3.x"
|
||||
}
|
||||
},
|
||||
"csstype": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.2.tgz",
|
||||
"integrity": "sha512-ofovWglpqoqbfLNOTBNZLSbMuGrblAf1efvvArGKOZMBrIoJeu5UsAipQolkijtyQx5MtAzT/J9IHj/CEY1mJw=="
|
||||
},
|
||||
"cyclist": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz",
|
||||
@@ -4377,15 +4325,6 @@
|
||||
"utila": "~0.4"
|
||||
}
|
||||
},
|
||||
"dom-helpers": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.0.tgz",
|
||||
"integrity": "sha512-Ru5o9+V8CpunKnz5LGgWXkmrH/20cGKwcHwS4m73zIvs54CN9epEmT/HLqFJW3kXpakAFkEdzgy1hzlJe3E4OQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"csstype": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"dom-serializer": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz",
|
||||
@@ -5884,6 +5823,11 @@
|
||||
"integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==",
|
||||
"optional": true
|
||||
},
|
||||
"fsts": {
|
||||
"version": "0.0.44",
|
||||
"resolved": "https://registry.npmjs.org/fsts/-/fsts-0.0.44.tgz",
|
||||
"integrity": "sha512-0U4qvbzOE+3s2711DdszIyaAnZ3M0dbFAhnkez/ITy31MwzDI2lepGSkVeFOyx6jqWvwaSZr01RP4hdM4I8wxQ=="
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
@@ -7864,11 +7808,6 @@
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
|
||||
},
|
||||
"lodash-es": {
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.15.tgz",
|
||||
"integrity": "sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ=="
|
||||
},
|
||||
"lodash._reinterpolate": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz",
|
||||
@@ -10161,15 +10100,6 @@
|
||||
"react-is": "^16.8.1"
|
||||
}
|
||||
},
|
||||
"prop-types-extra": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/prop-types-extra/-/prop-types-extra-1.1.1.tgz",
|
||||
"integrity": "sha512-59+AHNnHYCdiC+vMwY52WmvP5dM3QLeoumYuEyceQDi9aEhtwN9zIQ2ZNo25sMyXnbh32h+P1ezDsUpUH3JAew==",
|
||||
"requires": {
|
||||
"react-is": "^16.3.2",
|
||||
"warning": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"proxy-addr": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
|
||||
@@ -10354,31 +10284,6 @@
|
||||
"whatwg-fetch": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"react-bootstrap": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-1.3.0.tgz",
|
||||
"integrity": "sha512-GYj0c6FO9mx7DaO8Xyz2zs0IcQ6CGCtM3O6/feIoCaG4N8B0+l4eqL7stlMcLpqO4d8NG2PoMO/AbUOD+MO7mg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.2",
|
||||
"@restart/context": "^2.1.4",
|
||||
"@restart/hooks": "^0.3.21",
|
||||
"@types/classnames": "^2.2.10",
|
||||
"@types/invariant": "^2.2.33",
|
||||
"@types/prop-types": "^15.7.3",
|
||||
"@types/react": "^16.9.35",
|
||||
"@types/react-transition-group": "^4.4.0",
|
||||
"@types/warning": "^3.0.0",
|
||||
"classnames": "^2.2.6",
|
||||
"dom-helpers": "^5.1.2",
|
||||
"invariant": "^2.2.4",
|
||||
"prop-types": "^15.7.2",
|
||||
"prop-types-extra": "^1.1.0",
|
||||
"react-overlays": "^4.1.0",
|
||||
"react-transition-group": "^4.4.1",
|
||||
"uncontrollable": "^7.0.0",
|
||||
"warning": "^4.0.3"
|
||||
}
|
||||
},
|
||||
"react-dev-utils": {
|
||||
"version": "10.2.1",
|
||||
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-10.2.1.tgz",
|
||||
@@ -10609,11 +10514,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||
},
|
||||
"react-lifecycles-compat": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
|
||||
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
|
||||
},
|
||||
"react-markdown": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-4.3.1.tgz",
|
||||
@@ -10629,21 +10529,6 @@
|
||||
"xtend": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"react-overlays": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/react-overlays/-/react-overlays-4.1.0.tgz",
|
||||
"integrity": "sha512-vdRpnKe0ckWOOD9uWdqykLUPHLPndIiUV7XfEKsi5008xiyHCfL8bxsx4LbMrfnxW1LzRthLyfy50XYRFNQqqw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.5",
|
||||
"@popperjs/core": "^2.0.0",
|
||||
"@restart/hooks": "^0.3.12",
|
||||
"@types/warning": "^3.0.0",
|
||||
"dom-helpers": "^5.1.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"uncontrollable": "^7.0.0",
|
||||
"warning": "^4.0.3"
|
||||
}
|
||||
},
|
||||
"react-router": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz",
|
||||
@@ -10750,17 +10635,6 @@
|
||||
"workbox-webpack-plugin": "4.3.1"
|
||||
}
|
||||
},
|
||||
"react-transition-group": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.1.tgz",
|
||||
"integrity": "sha512-Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKGw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"dom-helpers": "^5.0.1",
|
||||
"loose-envify": "^1.4.0",
|
||||
"prop-types": "^15.6.2"
|
||||
}
|
||||
},
|
||||
"read-pkg": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
|
||||
@@ -12692,17 +12566,6 @@
|
||||
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
||||
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
|
||||
},
|
||||
"uncontrollable": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/uncontrollable/-/uncontrollable-7.1.1.tgz",
|
||||
"integrity": "sha512-EcPYhot3uWTS3w00R32R2+vS8Vr53tttrvMj/yA1uYRhf8hbTG2GyugGqWDY0qIskxn0uTTojVd6wPYW9ZEf8Q==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@types/react": "^16.9.11",
|
||||
"invariant": "^2.2.4",
|
||||
"react-lifecycles-compat": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"unherit": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz",
|
||||
@@ -13076,14 +12939,6 @@
|
||||
"makeerror": "1.0.x"
|
||||
}
|
||||
},
|
||||
"warning": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",
|
||||
"integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==",
|
||||
"requires": {
|
||||
"loose-envify": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"watchpack": {
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.4.tgz",
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"bootstrap": "^4.5.2",
|
||||
"bootstrap-4-react": "0.0.59",
|
||||
"crypto-js": "^4.0.0",
|
||||
"react": "^16.9.0",
|
||||
"react-bootstrap": "^1.3.0",
|
||||
"react-dom": "^16.9.0",
|
||||
"react-highlight": "^0.12.0",
|
||||
"react-markdown": "^4.3.1",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, { Component } from 'react';
|
||||
import { BrowserRouter, Route, Switch } from 'react-router-dom';
|
||||
|
||||
import 'bootstrap/dist/css/bootstrap.css';
|
||||
import './paste/Framework.css';
|
||||
|
||||
import Paste from './paste/Paste';
|
||||
@@ -21,7 +20,7 @@ class App extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
req('/app-info').get()
|
||||
req('https://paste.dn42.us/app-info').get()
|
||||
.then((response) => {
|
||||
if (response.ok) return response.text().catch(()=>"");
|
||||
else return "Unknown API"; })
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
body,html {color: #c8c8c8; background-color: #272b30; }
|
||||
body,html {color: #c8c8c8 !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}
|
||||
.breadcrumb label { color: black; }
|
||||
|
||||
.sidebar .list-group {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { Component } from "react";
|
||||
import { Form, Button, Alert } from "react-bootstrap";
|
||||
import { Form, Button, Alert } from "bootstrap-4-react";
|
||||
|
||||
import "./paste.css";
|
||||
|
||||
@@ -185,7 +185,7 @@ class Paste extends Component {
|
||||
this.setState(function(state, props) {
|
||||
return {entropy: state.entropy + s.length};
|
||||
} );
|
||||
Math.seedrandom(s, {entropy: true});
|
||||
seedrandom(s, {entropy: true});
|
||||
};
|
||||
|
||||
onChange(event) {
|
||||
@@ -319,24 +319,21 @@ function PasteCreate({error, onSubmit, onChange, syntax, syntaxItems, expire, ex
|
||||
</Alert> : ""}
|
||||
|
||||
<Form name='paste' onSubmit={onSubmit}>
|
||||
<div className="form form-inline">
|
||||
<ol className='breadcrumb'>
|
||||
<li>
|
||||
<label>Syntax</label>
|
||||
<select className='form-control input-sm' name="syntax" onChange={onChange} value={syntax}>
|
||||
{syntaxItems.map((o) => <option key={o[0]} value={o[0]}>{o[1]}</option>)}
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label>Expires</label>
|
||||
<select className='form-control input-sm' name="expire" onChange={onChange} value={expire}>
|
||||
{expireItems.map((o) => <option key={o[0]} value={o[0]}>{o[1]}</option>)}
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label><input type='checkbox' name="burn" onChange={onChange} value={burn}/> Burn on Read</label>
|
||||
</li>
|
||||
</ol>
|
||||
<div className="form-inline">
|
||||
<label className="my-1 mr-2" for="syntax">Syntax</label>
|
||||
<select className='custom-select my-1 mr-sm-2' id="syntax" name="syntax" onChange={onChange} value={syntax}>
|
||||
{syntaxItems.map((o) => <option key={o[0]} value={o[0]}>{o[1]}</option>)}
|
||||
</select>
|
||||
|
||||
<label className="my-1 mr-2" for="expire">Expires</label>
|
||||
<select className='custom-select my-1 mr-sm-2' id="expire" name="expire" onChange={onChange} value={expire}>
|
||||
{expireItems.map((o) => <option key={o[0]} value={o[0]}>{o[1]}</option>)}
|
||||
</select>
|
||||
|
||||
<div className="custom-control custom-checkbox my-1 mr-sm-2">
|
||||
<input className="custom-control-input" type='checkbox' id="burn-on-read" name="burn" onChange={onChange} value={burn}/>
|
||||
<label className="custom-control-label" for="burn-on-read">Burn on Read</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<textarea required className='form-control' rows='20' name="plain" onChange={onChange} value={plain}></textarea>
|
||||
@@ -346,7 +343,6 @@ function PasteCreate({error, onSubmit, onChange, syntax, syntaxItems, expire, ex
|
||||
</Form>
|
||||
|
||||
<p>Create pastes from the command line! <a href='./paste.sh' download>paste.sh</a></p>
|
||||
|
||||
<pre>{`$ echo /etc/passwd | ./paste.sh
|
||||
|
||||
env options:
|
||||
@@ -366,11 +362,11 @@ function PasteView({hash, decryptKey, expires, gzip, cipher, plain, syntax, onNe
|
||||
<section className="container">
|
||||
<div className="input-group">
|
||||
<span className="input-group-btn">
|
||||
<a className="btn btn-default" type="button" onClick={onNew}>New</a>
|
||||
<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">
|
||||
<a className="btn btn-default" type="button" onClick={onCopy}>Copy</a>
|
||||
<button className="btn btn-default" type="button" onClick={onCopy}>Copy</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
35
cmd/paste/cors.go
Normal file
35
cmd/paste/cors.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"sour.is/x/toolbox/httpsrv"
|
||||
"sour.is/x/toolbox/ident"
|
||||
)
|
||||
|
||||
func init() {
|
||||
httpsrv.NewMiddleware("cors", doCORS).
|
||||
Register(httpsrv.EventPreAuth)
|
||||
}
|
||||
|
||||
func doCORS(_ string, w httpsrv.ResponseWriter, r *http.Request, _ ident.Ident) bool {
|
||||
origin := r.Header.Get("origin")
|
||||
headers := r.Header.Get("access-control-request-headers")
|
||||
|
||||
if origin != "" {
|
||||
w.Header().Add("access-control-allow-origin", origin)
|
||||
}
|
||||
|
||||
w.Header().Add("access-control-allow-methods", "GET, POST, PUT, DELETE, OPTIONS")
|
||||
w.Header().Add("access-control-allow-credentials", "true")
|
||||
w.Header().Add("access-control-max-age", "3600")
|
||||
if headers != "" {
|
||||
w.Header().Add("access-control-allow-headers", headers)
|
||||
}
|
||||
|
||||
if r.Method == "OPTIONS" {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
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 @@
|
||||
17
|
||||
1
debian/VERSION
vendored
1
debian/VERSION
vendored
@@ -1 +0,0 @@
|
||||
2.2.0
|
||||
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]}"
|
||||
1
go.mod
1
go.mod
@@ -8,6 +8,7 @@ require (
|
||||
github.com/go-swagger/go-swagger v0.23.0
|
||||
github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2 // indirect
|
||||
github.com/gorilla/mux v1.7.3
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/sour-is/go-assetfs v1.0.0
|
||||
github.com/spf13/viper v1.6.2
|
||||
github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e
|
||||
|
||||
1
go.sum
1
go.sum
@@ -251,6 +251,7 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn
|
||||
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
|
||||
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
|
||||
@@ -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(1597685436, 0)}
|
||||
info := bindataFileInfo{name: "public/swagger.json", size: 4895, mode: os.FileMode(0644), modTime: time.Unix(1598654963, 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
120
src/routes/shorturl.go
Normal file
120
src/routes/shorturl.go
Normal file
@@ -0,0 +1,120 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/patrickmn/go-cache"
|
||||
"sour.is/x/toolbox/httpsrv"
|
||||
"sour.is/x/toolbox/uuid"
|
||||
)
|
||||
|
||||
func init() {
|
||||
s := NewShortManager(365 * 24 * time.Hour)
|
||||
|
||||
httpsrv.HttpRegister("short", httpsrv.HttpRoutes{
|
||||
{Name: "getShort", Method: "GET", Pattern: "/s/{id}", HandlerFunc: s.getShort},
|
||||
{Name: "putShort", Method: "PUT", Pattern: "/s/{id}", HandlerFunc: s.putShort},
|
||||
})
|
||||
}
|
||||
|
||||
type shortManager struct {
|
||||
defaultExpire time.Duration
|
||||
db *cache.Cache
|
||||
}
|
||||
|
||||
type shortURL struct {
|
||||
ID string
|
||||
URL string
|
||||
Secret string
|
||||
}
|
||||
|
||||
func NewShortManager(defaultExpire time.Duration) *shortManager {
|
||||
return &shortManager{
|
||||
defaultExpire: defaultExpire,
|
||||
db: cache.New(defaultExpire, defaultExpire/10),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *shortManager) GetURL(id string) *shortURL {
|
||||
if u, ok := s.db.Get(id); ok {
|
||||
if url, ok := u.(*shortURL); ok {
|
||||
return url
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
func (s *shortManager) PutURL(id string, url *shortURL) {
|
||||
s.db.SetDefault(id, url)
|
||||
}
|
||||
|
||||
func (s *shortManager) getShort(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
|
||||
id := vars["id"]
|
||||
url := s.GetURL(id)
|
||||
|
||||
if url == nil {
|
||||
httpsrv.WriteError(w, 404, "not found")
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Location", url.URL)
|
||||
w.WriteHeader(http.StatusFound)
|
||||
}
|
||||
|
||||
func (s *shortManager) putShort(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
|
||||
vars := mux.Vars(r)
|
||||
|
||||
id := vars["id"]
|
||||
secret := r.FormValue("secret")
|
||||
u, err := url.Parse(r.FormValue("url"))
|
||||
if err != nil {
|
||||
httpsrv.WriteError(w, 400, "bad url")
|
||||
return
|
||||
}
|
||||
|
||||
short := s.GetURL(id)
|
||||
|
||||
if short == nil {
|
||||
short = newshort(id, secret, u.String())
|
||||
|
||||
s.PutURL(short.ID, short)
|
||||
httpsrv.WriteObject(w, 200, short)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if secret == "" {
|
||||
httpsrv.WriteError(w, 401, "no auth")
|
||||
return
|
||||
}
|
||||
|
||||
if secret != short.Secret {
|
||||
httpsrv.WriteError(w, 403, "forbidden")
|
||||
return
|
||||
}
|
||||
|
||||
short.URL = u.String()
|
||||
|
||||
s.PutURL(short.ID, short)
|
||||
httpsrv.WriteObject(w, 200, short)
|
||||
}
|
||||
|
||||
func newshort(id, secret, u string) *shortURL {
|
||||
m, err := regexp.MatchString("[a-z-]{1,64}", id)
|
||||
if id == "" || !m || err != nil {
|
||||
id = uuid.V4()
|
||||
}
|
||||
m, err = regexp.MatchString("[a-z-]{1,64}", secret)
|
||||
if secret == "" || !m || err != nil {
|
||||
secret = uuid.V4()
|
||||
}
|
||||
return &shortURL{ID: id, Secret: secret, URL: u}
|
||||
}
|
||||
Reference in New Issue
Block a user