mirror of
https://github.com/rikkaneko/paste.git
synced 2025-06-06 16:45:41 +00:00
Update project dependencies version
Add .eslintrc and .prettierrc Signed-off-by: Joe Ma <rikkaneko23@gmail.com>
This commit is contained in:
parent
50244f0c1e
commit
2ea3b0dd8d
7 changed files with 1791 additions and 550 deletions
32
.eslintrc.json
Normal file
32
.eslintrc.json
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended-type-checked", "prettier"],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"project": ["./tsconfig.json"],
|
||||||
|
"sourceType": "module",
|
||||||
|
"ecmaVersion": 2020
|
||||||
|
},
|
||||||
|
"plugins": ["@typescript-eslint"],
|
||||||
|
"root": true,
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"warn", // or "error"
|
||||||
|
{
|
||||||
|
"argsIgnorePattern": "^_",
|
||||||
|
"varsIgnorePattern": "^_",
|
||||||
|
"caughtErrorsIgnorePattern": "^_"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-misused-promises": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"checksVoidReturn": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
8
.prettierrc
Normal file
8
.prettierrc
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"printWidth": 120,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"bracketSameLine": true,
|
||||||
|
"tabWidth": 2
|
||||||
|
}
|
24
package.json
24
package.json
|
@ -1,15 +1,27 @@
|
||||||
{
|
{
|
||||||
"name": "paste",
|
"name": "paste",
|
||||||
"version": "1.3",
|
"version": "1.3.1",
|
||||||
|
"scripts": {
|
||||||
|
"publish": "wrangler deploy",
|
||||||
|
"format": "prettier --write .",
|
||||||
|
"lint": "eslint . --color --cache -f friendly --max-warnings 10"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"aws4fetch": "^1.0.17",
|
"aws4fetch": "^1.0.17",
|
||||||
"dedent-js": "^1.0.1",
|
"dedent-js": "^1.0.1",
|
||||||
"js-sha256": "^0.9.0",
|
"js-sha256": "^0.10.1",
|
||||||
"nanoid": "^4.0.1"
|
"nanoid": "^5.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cloudflare/workers-types": "^4.20230321.0",
|
"@cloudflare/workers-types": "^4.20231025.0",
|
||||||
"typescript": "^5.0.2",
|
"@types/bootstrap": "^5.2.8",
|
||||||
"wrangler": "^2.13.0"
|
"@types/jquery": "^3.5.25",
|
||||||
|
"eslint": "^8.52.0",
|
||||||
|
"eslint-config-prettier": "^9.0.0",
|
||||||
|
"eslint-formatter-friendly": "^7.0.0",
|
||||||
|
"eslint-plugin-import": "^2.29.0",
|
||||||
|
"prettier": "^3.0.3",
|
||||||
|
"typescript": "^5.2.2",
|
||||||
|
"wrangler": "^3.15.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
20
web/.eslintrc.json
Normal file
20
web/.eslintrc.json
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"extends": ["eslint:recommended", "prettier"],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2020
|
||||||
|
},
|
||||||
|
"plugins": ["plugin"],
|
||||||
|
"settings": {
|
||||||
|
"import/resolver": {
|
||||||
|
"node": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": true,
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"jquery": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-unused-vars": "off"
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,8 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/// <reference path="../../../node_modules/@types/bootstrap/index.d.ts" />
|
||||||
|
|
||||||
const endpoint = 'https://pb.nekoid.cc';
|
const endpoint = 'https://pb.nekoid.cc';
|
||||||
|
|
||||||
let input_div = {
|
let input_div = {
|
||||||
|
@ -57,13 +59,15 @@ function validate_url(path) {
|
||||||
|
|
||||||
function show_pop_alert(message, alert_type = 'alert-primary', add_classes = null) {
|
function show_pop_alert(message, alert_type = 'alert-primary', add_classes = null) {
|
||||||
remove_pop_alert();
|
remove_pop_alert();
|
||||||
$('#alert-container').prepend(jQuery.parseHTML(
|
$('#alert-container').prepend(
|
||||||
|
jQuery.parseHTML(
|
||||||
`<div class="alert ${alert_type} alert-dismissible position-absolute fade show top-0 start-50 translate-middle-x"
|
`<div class="alert ${alert_type} alert-dismissible position-absolute fade show top-0 start-50 translate-middle-x"
|
||||||
style="margin-top: 30px; max-width: 500px; width: 80%" id="pop_alert" role="alert"> \
|
style="margin-top: 30px; max-width: 500px; width: 80%" id="pop_alert" role="alert"> \
|
||||||
<div>${message}</div> \
|
<div>${message}</div> \
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> \
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> \
|
||||||
</div>`,
|
</div>`
|
||||||
));
|
)
|
||||||
|
);
|
||||||
if (add_classes) {
|
if (add_classes) {
|
||||||
$('.alert').addClass(add_classes);
|
$('.alert').addClass(add_classes);
|
||||||
}
|
}
|
||||||
|
@ -72,8 +76,7 @@ function show_pop_alert(message, alert_type = 'alert-primary', add_classes = nul
|
||||||
|
|
||||||
function remove_pop_alert() {
|
function remove_pop_alert() {
|
||||||
const alert = $('#pop_alert');
|
const alert = $('#pop_alert');
|
||||||
if (alert.length)
|
if (alert.length) alert.remove();
|
||||||
alert.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_paste_modal(paste_info, show_qrcode = true, saved = true, build_only = false) {
|
function build_paste_modal(paste_info, show_qrcode = true, saved = true, build_only = false) {
|
||||||
|
@ -100,7 +103,7 @@ function build_paste_modal(paste_info, show_qrcode = true, saved = true, build_o
|
||||||
else paste_modal.qrcode.removeClass('d-none');
|
else paste_modal.qrcode.removeClass('d-none');
|
||||||
|
|
||||||
// Hide/Show Forget button
|
// Hide/Show Forget button
|
||||||
if (!!cached_paste_info) paste_modal.forget_btn.removeClass('d-none');
|
if (!cached_paste_info) paste_modal.forget_btn.removeClass('d-none');
|
||||||
else paste_modal.forget_btn.addClass('d-none');
|
else paste_modal.forget_btn.addClass('d-none');
|
||||||
|
|
||||||
Object.entries(paste_info).forEach(([key, val]) => {
|
Object.entries(paste_info).forEach(([key, val]) => {
|
||||||
|
@ -148,7 +151,7 @@ $(function () {
|
||||||
|
|
||||||
// Restore saved paste info
|
// Restore saved paste info
|
||||||
cached_paste_info = JSON.parse(localStorage.getItem('last_paste'));
|
cached_paste_info = JSON.parse(localStorage.getItem('last_paste'));
|
||||||
if (!!cached_paste_info) {
|
if (!cached_paste_info) {
|
||||||
show_saved_btn.prop('disabled', false);
|
show_saved_btn.prop('disabled', false);
|
||||||
console.log('Restored cache paste');
|
console.log('Restored cache paste');
|
||||||
}
|
}
|
||||||
|
@ -243,7 +246,7 @@ $(function () {
|
||||||
// Remove empty entries
|
// Remove empty entries
|
||||||
let filtered = new FormData();
|
let filtered = new FormData();
|
||||||
formdata.forEach((val, key) => {
|
formdata.forEach((val, key) => {
|
||||||
if (!!val) filtered.set(key, val);
|
if (!val) filtered.set(key, val);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Request JSON response
|
// Request JSON response
|
||||||
|
@ -279,7 +282,7 @@ $(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
show_saved_btn.on('click', function () {
|
show_saved_btn.on('click', function () {
|
||||||
if (!!!cached_paste_info) {
|
if (!cached_paste_info) {
|
||||||
show_pop_alert('No saved paste found.', 'alert-warning');
|
show_pop_alert('No saved paste found.', 'alert-warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -339,7 +342,7 @@ $(function () {
|
||||||
paste_modal.forget_btn.on('click', function () {
|
paste_modal.forget_btn.on('click', function () {
|
||||||
let tooltip = bootstrap.Tooltip.getInstance(paste_modal.forget_btn);
|
let tooltip = bootstrap.Tooltip.getInstance(paste_modal.forget_btn);
|
||||||
|
|
||||||
if (!!cached_paste_info) {
|
if (!cached_paste_info) {
|
||||||
cached_paste_info = null;
|
cached_paste_info = null;
|
||||||
localStorage.removeItem('last_paste');
|
localStorage.removeItem('last_paste');
|
||||||
console.log('Removed cached paste');
|
console.log('Removed cached paste');
|
||||||
|
@ -351,12 +354,10 @@ $(function () {
|
||||||
show_qrcode_checkbox.on('click', function () {
|
show_qrcode_checkbox.on('click', function () {
|
||||||
show_qrcode = show_qrcode_checkbox.prop('checked');
|
show_qrcode = show_qrcode_checkbox.prop('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function select_input_type(name) {
|
function select_input_type(name) {
|
||||||
Object.keys(input_div).forEach(key => {
|
Object.keys(input_div).forEach((key) => {
|
||||||
input_div[key].collapse('hide');
|
input_div[key].collapse('hide');
|
||||||
inputs[key].prop('disabled', true);
|
inputs[key].prop('disabled', true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width initial-scale=1 shrink-to-fit=1">
|
<meta name="viewport" content="width=device-width initial-scale=1 shrink-to-fit=1">
|
||||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
|
||||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.9.1/font/bootstrap-icons.min.css"
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.9.1/font/bootstrap-icons.min.css"
|
||||||
rel="stylesheet">
|
rel="stylesheet">
|
||||||
<link href="css/paste.css" rel="stylesheet">
|
<link href="css/paste.css" rel="stylesheet">
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.6/umd/popper.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.6/umd/popper.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.2/js/bootstrap.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/js/bootstrap.min.js"></script>
|
||||||
<script src="js/paste.js"></script>
|
<script src="js/paste.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue