Compare commits

...

3 Commits

Author SHA1 Message Date
timvisee
1469464c43 Bump version to 3.2.1 2020-10-16 18:18:19 +02:00
Danny Coates
7cdef4bbfc added qr code to copyDialog
Co-authored-by: timvisee <tim@visee.me>
2020-10-16 18:16:14 +02:00
timvisee
24aa1f2e17 Add badges to README 2020-10-16 16:42:40 +02:00
7 changed files with 1133 additions and 10 deletions

View File

@@ -5,3 +5,4 @@ coverage
android/app/build
app/locale.js
app/capabilities.js
app/qrcode.js

View File

@@ -1,5 +1,15 @@
# [![Send](./assets/icon.svg)](https://gitlab.com/timvisee/send/) Send
[![Build status on GitLab CI][gitlab-ci-master-badge]][gitlab-ci-link]
[![Docker image][docker-image-badge]][docker-image-link]
[![Project license][repo-license-badge]](LICENSE)
[docker-image-badge]: https://img.shields.io/badge/docker-latest-blue.svg
[docker-image-link]: https://gitlab.com/timvisee/send/container_registry/eyJuYW1lIjoidGltdmlzZWUvc2VuZCIsInRhZ3NfcGF0aCI6Ii90aW12aXNlZS9zZW5kL3JlZ2lzdHJ5L3JlcG9zaXRvcnkvMTQxODUwNC90YWdzP2Zvcm1hdD1qc29uIiwiaWQiOjE0MTg1MDQsImNsZWFudXBfcG9saWN5X3N0YXJ0ZWRfYXQiOm51bGx9
[gitlab-ci-link]: https://gitlab.com/timvisee/send/pipelines
[gitlab-ci-master-badge]: https://gitlab.com/timvisee/send/badges/master/pipeline.svg
[repo-license-badge]: https://img.shields.io/github/license/timvisee/send.svg
Based on Mozilla's [Firefox Send](https://github.com/mozilla/send),
with branding removed.
@@ -109,4 +119,6 @@ The android implementation is contained in the `android` directory, and can be v
[Mozilla Public License Version 2.0](LICENSE)
[qrcode.js](https://github.com/kazuhikoarase/qrcode-generator) licensed under MIT
---

1076
app/qrcode.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
const html = require('choo/html');
const { copyToClipboard } = require('../utils');
const qr = require('./qr');
module.exports = function(name, url) {
const dialog = function(state, emit, close) {
@@ -16,13 +17,23 @@ module.exports = function(name, url) {
${state.translate('copyLinkDescription')} <br />
${name}
</p>
<input
type="text"
id="share-url"
class="w-full my-4 border rounded-lg leading-loose h-12 px-2 py-1 dark:bg-grey-80"
value="${url}"
readonly="true"
/>
<div class="flex flex-row items-center justify-center w-full">
<input
type="text"
id="share-url"
class="block w-full my-4 border rounded-lg leading-loose h-12 px-2 py-1 dark:bg-grey-80"
value="${url}"
readonly="true"
/>
<button
id="qr-btn"
class="w-16 m-1 p-1"
onclick="${toggleQR}"
title="QR code"
>
${qr(url)}
</button>
</div>
<button
class="btn rounded-lg w-full flex-shrink-0 focus:outline"
onclick="${copy}"
@@ -40,6 +51,19 @@ module.exports = function(name, url) {
</send-copy-dialog>
`;
function toggleQR(event) {
event.stopPropagation();
const shareUrl = document.getElementById('share-url');
const qrBtn = document.getElementById('qr-btn');
if (shareUrl.classList.contains('hidden')) {
shareUrl.classList.replace('hidden', 'block');
qrBtn.classList.replace('w-48', 'w-16');
} else {
shareUrl.classList.replace('block', 'hidden');
qrBtn.classList.replace('w-16', 'w-48');
}
}
function copy(event) {
event.stopPropagation();
copyToClipboard(url);

10
app/ui/qr.js Normal file
View File

@@ -0,0 +1,10 @@
const raw = require('choo/html/raw');
const qrcode = require('../qrcode');
module.exports = function(url) {
const gen = qrcode(5, 'L');
gen.addData(url);
gen.make();
const qr = gen.createSvgTag({ scalable: true });
return raw(qr);
};

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "send",
"version": "3.2.0",
"version": "3.2.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,7 +1,7 @@
{
"name": "send",
"description": "File Sharing Experiment",
"version": "3.2.0",
"version": "3.2.1",
"author": "Mozilla (https://mozilla.org)",
"contributors": [
"Tim Visee <3a4fb3964f@sinenomine.email> (https://timvisee.com)"