Skip to content

Commit

Permalink
fix code-style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stv0g committed Mar 30, 2022
1 parent 465a88a commit 6654ce2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 55 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

## Features

- Installation via single binary or container
- Scalable to multiple replicas
- No other backend services apart from S3 storage are required
- Upload progress-bar and transfer statistics
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Expiration {
id: string = "";
title: string = "";
days: number = 0;
};
}

export class Server {
id: string = "";
Expand Down
32 changes: 16 additions & 16 deletions frontend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async function startUpload(files: FileList) {

new Notification("Upload completed", {
body: `Upload of ${size} for ${upload.file.name} has been completed in ${dur}.`,
icon: 'gose-logo.svg',
icon: "gose-logo.svg",
renotify: true,
tag: upload.uploadID
});
Expand All @@ -112,7 +112,7 @@ async function startUpload(files: FileList) {
if (params.notify_browser) {
new Notification("Upload failed", {
body: `Upload failed: ${e.status} - ${e.statusText}`,
icon: 'gose-logo.svg',
icon: "gose-logo.svg",
});
}
} finally {
Expand Down Expand Up @@ -183,16 +183,16 @@ function updateExpiration(server: Server) {
selExpirationClasses.innerHTML = "";

for (let cls of server.expiration) {
var opt = document.createElement('option');
var opt = document.createElement("option");
opt.value = cls.id;
opt.innerHTML = cls.title;
selExpirationClasses.appendChild(opt);
}

if (server.expiration.length > 1) {
divExpiration.classList.remove('d-none');
divExpiration.classList.remove("d-none");
} else {
divExpiration.classList.add('d-none');
divExpiration.classList.add("d-none");
}
}

Expand All @@ -209,7 +209,7 @@ function getUploadParams(): UploadParams {
params.server = selServers.value;
params.notify_browser = cbNotifyBrowser.checked;

if (selExpiration.value != "") {
if (selExpiration.value !== "") {
params.expiration = selExpiration.value;
}

Expand All @@ -222,23 +222,23 @@ function getUploadParams(): UploadParams {

function onConfig(config: Config) {
let selServers = document.getElementById("servers") as HTMLSelectElement;
let divServers = document.getElementById('config-servers');
let divServers = document.getElementById("config-servers");

for (let svr of config.servers) {
var opt = document.createElement('option');
var opt = document.createElement("option");
opt.value = svr.id;
opt.innerHTML = svr.title;
selServers.appendChild(opt);
}

if (config.servers.length > 1) {
divServers.classList.remove('d-none');
divServers.classList.remove("d-none");
}

selServers.addEventListener('change', (ev) => {
selServers.addEventListener("change", (ev) => {
for (let svr of config.servers) {
let opt = ev.target as HTMLOptionElement;
if (svr.id == opt.value) {
if (svr.id === opt.value) {
updateExpiration(svr);
}
}
Expand All @@ -255,7 +255,7 @@ function onConfig(config: Config) {
divNotifyMail.classList.remove("d-none");
}

if (config.features.notify_browser && 'Notification' in window) {
if (config.features.notify_browser && "Notification" in window) {
let divNotifyBrowser = document.getElementById("config-notify-browser");
divNotifyBrowser.classList.remove("d-none");
}
Expand Down Expand Up @@ -304,15 +304,15 @@ export async function load() {
} else {
divNotifyMailAddress.classList.add("d-none");
}
})
});

// Enable desktop notifications
if ('Notification' in window) {
if ("Notification" in window) {
let swNotifyBrowser = document.getElementById("notify-browser") as HTMLInputElement;

if (Notification.permission == "granted") {
if (Notification.permission === "granted") {
swNotifyBrowser.checked = true;
} else if (Notification.permission == "denied") {
} else if (Notification.permission === "denied") {
swNotifyBrowser.disabled = true;
}
swNotifyBrowser.addEventListener("change", setupNotification);
Expand Down
36 changes: 0 additions & 36 deletions frontend/src/progress-stream.ts

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/src/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class Upload {

etags.push(etagExpected);
parts.push({
etag: etag,
etag,
part_number: i + 1
});
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
use: "ts-loader",
exclude: /node_modules/,
},
{
Expand Down

0 comments on commit 6654ce2

Please sign in to comment.