1
0
Fork 0

Compare commits

...

8 Commits
v0.1.0 ... main

Author SHA1 Message Date
dependabot[bot] 51a953b7ad Bump terser from 5.10.0 to 5.14.2 in /web
Bumps [terser](https://github.com/terser/terser) from 5.10.0 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-09 14:01:17 +08:00
dependabot[bot] 14bff45d21 Bump loader-utils from 3.2.0 to 3.2.1 in /web
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v3.2.0...v3.2.1)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-09 14:01:07 +08:00
dependabot[bot] 8f3644f9ba Bump minimist from 1.2.5 to 1.2.6 in /web
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-09 23:52:45 +08:00
Ambrose Chua 0d78f1dc33 feat: Upgrade versions, introduce Uppy batch signing 2022-02-16 16:22:31 +08:00
Ambrose Chua b5dacbc9bf ci: Fix Docker tagging 2021-11-16 21:48:07 +08:00
Ambrose Chua 927fb90f44
Create LICENSE 2021-11-16 13:16:19 +08:00
Ambrose Chua 8c3a91b0a8 chore: Bump Go version to 1.17 2021-11-16 13:10:49 +08:00
Ambrose Chua 967b469d65 chore: Bump versions 2021-11-16 13:09:27 +08:00
10 changed files with 1910 additions and 6214 deletions

View File

@ -21,7 +21,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
go-version: ^1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@ -42,7 +42,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
go-version: ^1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@ -63,7 +63,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
go-version: ^1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@ -80,7 +80,7 @@ jobs:
run: |
git add .
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git commit -m "[Action] go fmt" -a
git commit -m 'style: `go fmt`' -a
git push
fi
@ -97,7 +97,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
go-version: ^1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2

View File

@ -36,6 +36,11 @@ jobs:
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
id: meta
- name: Build and push Docker images

View File

@ -7,7 +7,7 @@ RUN cd web && npm install
ARG NODE_ENV=production
RUN cd web && npm run build
FROM golang:1.16-alpine3.14 as build
FROM golang:1.17-alpine3.14 as build
RUN apk add \
make

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Ambrose Chua
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -131,6 +131,61 @@ func handleGetUploadedParts(w http.ResponseWriter, req *http.Request) {
encoder.Encode(getUploadedPartsRes(parts))
}
/* batchSignPartsUpload */
type batchSignPartsUploadRes struct {
PresignedURLs map[string]string `json:"presignedUrls"`
}
func handleBatchSignPartsUpload(w http.ResponseWriter, req *http.Request) {
vars := mux.Vars(req)
cred, err := getCredential(vars["id"])
if err != nil {
errorResponse(w, req, err)
return
}
uploadID := vars["uploadID"]
key := req.URL.Query().Get("key")
partNumbers := req.URL.Query().Get("partNumbers")
if uploadID == "" || key == "" || partNumbers == "" {
errorResponse(w, req, fmt.Errorf("%w", errBadRequest))
return
}
partNumbersArray := strings.Split(partNumbers, ",")
partNumbersParsed := make([]uint16, 0, len(partNumbersArray))
for _, partNumber := range partNumbersArray {
n, err := strconv.ParseUint(partNumber, 10, 16)
if n < 1 || n > 10000 || err != nil {
errorResponse(w, req, fmt.Errorf("%w: invalid part number", errBadRequest))
return
}
partNumbersParsed = append(partNumbersParsed, uint16(n))
}
presignedURLs := make(map[string]string, len(partNumbersParsed))
for _, partNumber := range partNumbersParsed {
params := make(url.Values)
params.Add("partNumber", strconv.FormatUint(uint64(partNumber), 10))
params.Add("uploadId", uploadID)
unsignedReq, err := http.NewRequest(http.MethodPut, cred.Endpoint+"/"+key+"?"+params.Encode(), nil)
if err != nil {
errorResponse(w, req, fmt.Errorf("%w: %s", errInternalServerError, err))
return
}
signedReq := preSign(unsignedReq, cred)
presignedURLs[strconv.FormatUint(uint64(partNumber), 10)] = signedReq.URL.String()
}
encoder := json.NewEncoder(w)
encoder.Encode(batchSignPartsUploadRes{
PresignedURLs: presignedURLs,
})
}
/* signPartUpload */
type signPartUploadRes struct {

View File

@ -38,6 +38,7 @@ func main() {
s3Router.Methods(http.MethodPost).Path("").HandlerFunc(handleCreateMultipartUpload)
s3Router.Methods(http.MethodGet).Path("/{uploadID}").HandlerFunc(handleGetUploadedParts)
s3Router.Methods(http.MethodGet).Path("/{uploadID}/batch").HandlerFunc(handleBatchSignPartsUpload)
s3Router.Methods(http.MethodGet).Path("/{uploadID}/{uploadPart}").HandlerFunc(handleSignPartUpload)
s3Router.Methods(http.MethodPost).Path("/{uploadID}/complete").HandlerFunc(handleCompleteMultipartUpload)
s3Router.Methods(http.MethodDelete).Path("/{uploadID}").HandlerFunc(handleAbortMultipartUpload)

7998
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -8,18 +8,18 @@
"watch": "rollup --config --watch"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@tailwindcss/forms": "^0.3.2",
"@uppy/aws-s3-multipart": "^1.8.15",
"@uppy/core": "^1.18.1",
"@uppy/drag-drop": "^1.4.27",
"@uppy/status-bar": "^1.9.3",
"filesize": "^6.3.0",
"rollup": "^2.48.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.1.3",
"@tailwindcss/forms": "^0.4.0",
"@uppy/aws-s3-multipart": "^2.2.0",
"@uppy/core": "^2.1.5",
"@uppy/drag-drop": "^2.0.6",
"@uppy/status-bar": "^2.1.2",
"filesize": "^8.0.7",
"rollup": "^2.67.2",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-terser": "^7.0.2",
"tailwindcss": "^2.1.2"
"tailwindcss": "^3.0.22"
}
}

View File

@ -41,6 +41,12 @@ uploadAreas.forEach(uploadArea => {
}
/* Uppy */
let limit = window.localStorage.getItem('parallel');
if (!limit) {
limit = 3;
}
window.localStorage.setItem('parallel', 3);
const uppy = new Uppy({
autoProceed: true,
@ -54,7 +60,7 @@ uploadAreas.forEach(uploadArea => {
showProgressDetails: true,
});
uppy.use(AwsS3Multipart, {
limit: 3,
limit,
companionUrl: window.location.pathname,
});

View File

@ -1,5 +1,5 @@
module.exports = {
purge: [
content: [
'./*.tmpl',
'./src/*.js',
],