Skip to content

Commit

Permalink
Merge branch 'release/0.7.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Aug 23, 2022
2 parents f1847c7 + cfc52fe commit 4e5575f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [Unreleased]

## [0.7.3] - 2022-08-23
### Fixed
- Encryption support for Firefox ESR

## [0.7.2] - 2022-08-21
### Fixed
- Fix feature detection of streaming upload in Safari
Expand Down Expand Up @@ -378,7 +382,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
### Added
- First release

[Unreleased]: https://github.com/nwtgck/piping-ui-web/compare/v0.7.2...HEAD
[Unreleased]: https://github.com/nwtgck/piping-ui-web/compare/v0.7.3...HEAD
[0.7.3]: https://github.com/nwtgck/piping-ui-web/compare/v0.7.2...v0.7.3
[0.7.2]: https://github.com/nwtgck/piping-ui-web/compare/v0.7.1...v0.7.2
[0.7.1]: https://github.com/nwtgck/piping-ui-web/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/nwtgck/piping-ui-web/compare/v0.6.30...v0.7.0
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "piping-ui",
"version": "0.7.2",
"version": "0.7.3",
"private": true,
"author": "Ryo Ota <[email protected]> (https://github.com/nwtgck)",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataUploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,14 @@ export default class DataUploader extends Vue {
// Attach progress
const plainStreamWithProgress = this.getReadableStreamWithProgress(plainStream, plainBody.size);
// Encrypt
const encryptedStream = await utils.encryptStream(plainStreamWithProgress, password);
const encryptedStream = await utils.encrypt(plainStreamWithProgress, password);
try {
// Upload encrypted stream
await fetch(this.uploadPath, {
method: 'POST',
body: encryptedStream,
duplex: 'half',
} as any);
} as RequestInit);
} catch {
this.errorMessageDelegate = () => this.strings['data_uploader_xhr_upload_error'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/PipingUI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export default class PipingUI extends Vue {
// Disable "Powered by PQINA" link
filePond.setOptions({
credits: false,
} as any);
});
// Update random strings
this.updateRandomStrs();
Expand Down
13 changes: 3 additions & 10 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,7 @@ export async function sanitizeHtmlAllowingATag(dirtyHtml: string): Promise<strin
});
}

export async function encrypt(bytes: Uint8Array, password: string | Uint8Array): Promise<Uint8Array> {
const uint8ArrayToReadableStream = await uint8ArrayToReadableStreamAsync();
const readableStreamToUint8Array = await readableStreamToUint8ArrayAsync();
const encrypted = await encryptStream(uint8ArrayToReadableStream(bytes), password);
return readableStreamToUint8Array(encrypted);
}

export async function encryptStream(stream: ReadableStream<Uint8Array>, password: string | Uint8Array): Promise<ReadableStream<Uint8Array>> {
export async function encrypt<T extends Uint8Array | ReadableStream<Uint8Array>>(stream: T, password: string | Uint8Array): Promise<T> {
const openpgp = await openpgpAsync();
// Encrypt with PGP
const encryptResult = await openpgp.encrypt({
Expand All @@ -113,7 +106,7 @@ export async function encryptStream(stream: ReadableStream<Uint8Array>, password
armor: false
});
// Get encrypted
const encrypted: ReadableStream<Uint8Array> = encryptResult.message.packets.write();
const encrypted: T = encryptResult.message.packets.write();
return encrypted;
}

Expand Down Expand Up @@ -186,7 +179,7 @@ export async function supportsFetchUploadStreaming(pipingServerUrl: string): Pro
method: 'POST',
body: stream,
duplex: 'half',
} as any)
} as RequestInit)
// Without this, Safari causes an error "Unhandled Promise Rejection: NotSupportedError: ReadableStream uploading is not supported"
.catch(() => "fetch_error");
const getResPromise = fetch(url);
Expand Down

0 comments on commit 4e5575f

Please sign in to comment.