Web client add licensing info (#1481)

* chore: add '@license' tag to web sources' comments

Webpack's tersify plugin looks for that JSDoc tag in order to decide
which comments to extract into the generated license file.

* chore: address sonarcloud.io warnings

* chore: address sonarcloud.io code smells

* fixup! chore: address sonarcloud.io warnings
This commit is contained in:
Charles Kerr 2020-10-25 16:13:48 -05:00 committed by GitHub
parent cd453764b1
commit 61d221c8bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 129 additions and 67 deletions

View File

@ -2270,22 +2270,26 @@ char const* tr_get_mime_type_for_filename(char const* filename)
struct mime_type_suffix const* info = NULL;
char const* in = strrchr(filename, '.');
if ((in != NULL) && (strlen(++in) <= MIME_TYPE_SUFFIX_MAXLEN))
if (in != NULL)
{
char lowercase_suffix[MIME_TYPE_SUFFIX_MAXLEN + 1];
char* out = lowercase_suffix;
while (*in != '\0')
++in; // walk past '.'
if (strlen(in) <= MIME_TYPE_SUFFIX_MAXLEN)
{
*out++ = tolower((unsigned char)*in++);
char lowercase_suffix[MIME_TYPE_SUFFIX_MAXLEN + 1];
char* out = lowercase_suffix;
while (*in != '\0')
{
*out++ = (char)tolower((unsigned char)*in++);
}
*out = '\0';
info = bsearch(lowercase_suffix,
mime_type_suffixes,
TR_N_ELEMENTS(mime_type_suffixes),
sizeof(*mime_type_suffixes),
compareSuffix);
}
*out = '\0';
info = bsearch(lowercase_suffix,
mime_type_suffixes,
TR_N_ELEMENTS(mime_type_suffixes),
sizeof(*mime_type_suffixes),
compareSuffix);
}
return info != NULL ? info->mime_type : NULL;

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8,IE=9,IE=10" />
@ -65,7 +65,6 @@
id="toolbar-overflow"
></button>
</header>
<!-- class mainwin-toolbar -->
<header class="mainwin-filterbar" id="statusbar">
<span>Show</span>
@ -86,21 +85,19 @@
<div class="speed-up-icon"></div>
<div id="speed-up-label"></div>
</header>
<!-- class mainwin-filterbar -->
<main class="mainwin-workarea">
<div id="torrent-container">
<ul class="torrent-list flex" id="torrent-list"></ul>
</div>
</main>
<!-- class="mainwin-workarea" -->
<iframe
name="torrent-upload-frame"
id="torrent-upload-frame"
src="about:blank"
title="Add Torrent"
></iframe>
</div>
<!-- class mainwin -->
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
/**
* @license
*
* Copyright © Charles Kerr, Dave Perrett, Malcolm Jarvis and Bruno Bierbaumer
*
* This file is licensed under the GPLv2.
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.
*/

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
@ -10,6 +12,25 @@ import { Prefs } from './prefs.js';
import { RPC } from './remote.js';
import { OutsideClickListener, setEnabled } from './utils.js';
function make_section(classname, title) {
const section = document.createElement('fieldset');
section.classList.add('section', classname);
const legend = document.createElement('legend');
legend.classList.add('title');
legend.textContent = title;
section.append(legend);
return section;
}
function make_button(parent, text, action, on_click) {
const button = document.createElement('button');
button.textContent = text;
button.addEventListener('click', on_click);
parent.append(button);
button.dataset.action = action;
return button;
}
export class OverflowMenu extends EventTarget {
constructor(session_manager, prefs, remote, action_manager) {
super();
@ -123,29 +144,8 @@ export class OverflowMenu extends EventTarget {
_create(session_properties) {
const actions = {};
const on_click = this._onClick.bind(this);
const elements = {};
const make_section = (classname, title) => {
const section = document.createElement('fieldset');
section.classList.add('section', classname);
const legend = document.createElement('legend');
legend.classList.add('title');
legend.textContent = title;
section.append(legend);
return section;
};
const make_button = (parent, text, action) => {
const e = document.createElement('button');
e.textContent = text;
e.addEventListener('click', on_click);
parent.append(e);
if (action) {
e.dataset.action = action;
}
return e;
};
const on_click = this._onClick.bind(this);
const root = document.createElement('div');
root.classList.add('overflow-menu', 'popup');
@ -418,7 +418,7 @@ export class OverflowMenu extends EventTarget {
'start-all-torrents',
]) {
const text = this.action_manager.text(action_name);
actions[action_name] = make_button(section, text, action_name);
actions[action_name] = make_button(section, text, action_name, on_click);
}
section = make_section('info', 'Info');
@ -433,7 +433,7 @@ export class OverflowMenu extends EventTarget {
'show-statistics-dialog',
]) {
const text = this.action_manager.text(action_name);
actions[action_name] = make_button(options, text, action_name);
actions[action_name] = make_button(options, text, action_name, on_click);
}
section = make_section('links', 'Links');

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/**
* @license
*
* Copyright © Charles Kerr, Dave Perrett, Malcolm Jarvis and Bruno Bierbaumer
*
* This file is licensed under the GPLv2.

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -1,4 +1,6 @@
/**
* @license
*
* Copyright © Charles Kerr, Dave Perrett, Malcolm Jarvis and Bruno Bierbaumer
*
* This file is licensed under the GPLv2.

View File

@ -1,4 +1,6 @@
/*
/**
* @license
*
* This file Copyright (C) 2020 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3

View File

@ -910,6 +910,7 @@ $popup-top: 61px; // TODO: ugly that this is hardcoded
grid-row-gap: 5px;
grid-template-columns: auto 1fr;
margin: 20px;
padding: 12px;
&:not(.hidden) {
display: grid;
@ -958,10 +959,6 @@ $popup-top: 61px; // TODO: ugly that this is hardcoded
@include tab-image($image-network);
}
.inspector-info-page {
padding: 12px;
}
#inspector-file-list {
margin: 0;
padding: 0;