Merge branch 'develop'

This commit is contained in:
Alice Gaudon 2021-04-22 20:16:42 +02:00
commit a42d6c9333
7 changed files with 533 additions and 629 deletions

View File

@ -1,2 +1,18 @@
@import "layout"; @import "layout";
@import "fm"; @import "fm";
.file-upload-table {
@media (max-width: 550px) {
> thead > tr > th:nth-child(3),
> tbody > tr > td:nth-child(3) {
display: none;
}
}
@media (max-width: 785px) {
> thead > tr > th:nth-child(4),
> tbody > tr > td:nth-child(4) {
display: none;
}
}
}

View File

@ -667,6 +667,7 @@ button, .button {
// --- Tables // --- Tables
// --- // ---
td.actions { td.actions {
> * {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
@ -689,6 +690,7 @@ td.actions {
> *:not(:first-child) { > *:not(:first-child) {
margin-left: 8px; margin-left: 8px;
} }
}
} }
.data-table { .data-table {
@ -928,6 +930,25 @@ td.actions {
width: 100%; width: 100%;
} }
.table-col-grow-cell {
> * {
display: flex;
flex-direction: row;
> * {
width: 0;
flex-grow: 1;
white-space: nowrap;
text-overflow: ellipsis;
}
* {
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.pagination { .pagination {
ul { ul {
display: flex; display: flex;

View File

@ -12,4 +12,12 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
} }
}); });
document.querySelectorAll<HTMLElement>('.copy-button[data-content]').forEach(el => {
el.addEventListener('click', () => {
navigator.clipboard.writeText(`${el.dataset.content}`)
.then(() => console.log('copy success'))
.catch(console.error);
});
});
}); });

View File

@ -1,8 +1,8 @@
{ {
"name": "ily.li", "name": "ily.li",
"version": "1.0.2", "version": "1.0.3",
"description": "Self-hosted file pusher", "description": "Self-hosted file pusher",
"repository": "https://eternae.ink/arisu/ily.li", "repository": "https://eternae.ink/ashpie/ily.li",
"author": "Alice Gaudon <alice@gaudon.pro>", "author": "Alice Gaudon <alice@gaudon.pro>",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"main": "dist/main.js", "main": "dist/main.js",
@ -39,7 +39,7 @@
"eslint": "^7.10.0", "eslint": "^7.10.0",
"feather-icons": "^4.28.0", "feather-icons": "^4.28.0",
"file-loader": "^6.0.0", "file-loader": "^6.0.0",
"imagemin": "^7.0.1", "imagemin": "^7.0.0",
"imagemin-gifsicle": "^7.0.0", "imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^9.0.0", "imagemin-mozjpeg": "^9.0.0",
"imagemin-pngquant": "^9.0.0", "imagemin-pngquant": "^9.0.0",
@ -53,7 +53,7 @@
"sass-loader": "^11.0.1", "sass-loader": "^11.0.1",
"terser-webpack-plugin": "^5.0.3", "terser-webpack-plugin": "^5.0.3",
"ts-jest": "^26.1.1", "ts-jest": "^26.1.1",
"ts-loader": "^8.0.4", "ts-loader": "^9.1.0",
"typescript": "^4.0.2", "typescript": "^4.0.2",
"webpack": "^5.3.2", "webpack": "^5.3.2",
"webpack-cli": "^4.1.0" "webpack-cli": "^4.1.0"

View File

@ -18,11 +18,11 @@
id="upload-form"> id="upload-form">
{{ macros.field(_locals, 'file', 'upload', '', 'Choose wisely', 'The maximum upload size is ' + max_upload_size + 'MiB', validation_attributes='required') }} {{ macros.field(_locals, 'file', 'upload', '', 'Choose wisely', 'The maximum upload size is ' + max_upload_size + 'MiB', validation_attributes='required') }}
{{ macros.field(_locals, 'number', 'expire_after_days', '30', 'How many days to delete this file after', null, validation_attributes='max="1825"') }}
{{ macros.field(_locals, 'checkbox', 'never_expire', '', 'Never delete this file') }} {{ macros.field(_locals, 'checkbox', 'never_expire', '', 'Never delete this file') }}
{{ macros.field(_locals, 'number', 'expire_after_days', '30', 'How many days to delete this file after', null, validation_attributes='max="1825"') }}
{{ macros.field(_locals, 'text', 'slug', '', 'Custom url slug', 'Example: beautiful_image.jpg sets url to https://'+default_domain+'/beautiful_image.jpg', validation_attributes='disabled') }}
{{ macros.field(_locals, 'checkbox', 'autogen_url', '', 'Generate url automatically', null, validation_attributes='checked') }} {{ macros.field(_locals, 'checkbox', 'autogen_url', '', 'Generate url automatically', null, validation_attributes='checked') }}
{{ macros.field(_locals, 'text', 'slug', '', 'Custom url slug', 'Example: beautiful_image.jpg sets url to https://'+default_domain+'/beautiful_image.jpg', validation_attributes='disabled') }}
{{ macros.csrf(getCsrfToken) }} {{ macros.csrf(getCsrfToken) }}
@ -57,12 +57,11 @@
{{ macros.paginate(files.pagination, 'file-uploader', 3) }} {{ macros.paginate(files.pagination, 'file-uploader', 3) }}
<table class="data-table"> <table class="data-table file-upload-table">
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th class="table-col-grow">URL</th> <th class="table-col-grow">Name</th>
<th>Name</th>
<th>Size</th> <th>Size</th>
<th>Expires at</th> <th>Expires at</th>
<th>Actions</th> <th>Actions</th>
@ -73,26 +72,28 @@
{% for file in files %} {% for file in files %}
<tr> <tr>
<td>{{ file.id }}</td> <td>{{ file.id }}</td>
<td> <td class="table-col-grow-cell"><a href="{{ file.getURL() }}"><pre>{{ file.real_name }}</pre></a></td>
<div class="copyable-text">
<a class="content" href="{{ file.getURL() }}" target="_blank">{{ file.getURL() }}</a>
<button class="copy-button"><i data-feather="copy"></i></button>
</div>
</td>
<td><pre>{{ file.real_name }}</pre></td>
<td>{{ (file.size / (1024 * 1024)).toFixed(2) }}MB</td> <td>{{ (file.size / (1024 * 1024)).toFixed(2) }}MB</td>
<td>{% if file.expires_at %}{{ file.expires_at.toISOString() }}{% else %}Never{% endif %}</td> <td>{% if file.expires_at %}{{ file.expires_at.toISOString() }}{% else %}Never{% endif %}</td>
<td class="actions"> <td class="actions">
<div>
{% if file.shouldBeDeleted() %} {% if file.shouldBeDeleted() %}
Pending deletion Pending deletion
{% else %} {% else %}
<button class="copy-button" data-content="{{ file.getURL() }}"><i data-feather="copy"></i> <span class="tip">Copy URL</span></button>
<form action="{{ route('delete-file-frontend', file.slug) }}" method="post"> <form action="{{ route('delete-file-frontend', file.slug) }}" method="post">
{{ macros.csrf(getCsrfToken) }} {{ macros.csrf(getCsrfToken) }}
<button class="button danger"><i data-feather="trash"></i> <span class="tip">Delete</span></button> <button class="button danger" onclick="return confirm('Are you sure you want to delete file {{ file.real_name }}?');"><i data-feather="trash"></i> <span class="tip">Delete</span></button>
</form> </form>
{% endif %} {% endif %}
</div>
</td> </td>
</tr> </tr>
{% else %}
<tr>
<td colspan="5" class="center">You haven't uploaded any file yet.</td>
</tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>

View File

@ -17,8 +17,8 @@
<form action="{{ route('shrink-url') }}" method="POST" id="url-shrink-form"> <form action="{{ route('shrink-url') }}" method="POST" id="url-shrink-form">
{{ macros.field(_locals, 'text', 'target_url', '', 'Target URL', 'Only valid URLs starting with http:// or https://', validation_attributes='required') }} {{ macros.field(_locals, 'text', 'target_url', '', 'Target URL', 'Only valid URLs starting with http:// or https://', validation_attributes='required') }}
{{ macros.field(_locals, 'text', 'slug', '', 'Custom url slug', 'Example: bear sets url to https://'+default_domain+'/bear', validation_attributes='disabled') }}
{{ macros.field(_locals, 'checkbox', 'autogen_url', '', 'Generate url automatically', null, validation_attributes='checked') }} {{ macros.field(_locals, 'checkbox', 'autogen_url', '', 'Generate url automatically', null, validation_attributes='checked') }}
{{ macros.field(_locals, 'text', 'slug', '', 'Custom url slug', 'Example: bear sets url to https://'+default_domain+'/bear', validation_attributes='disabled') }}
{{ macros.csrf(getCsrfToken) }} {{ macros.csrf(getCsrfToken) }}
@ -45,8 +45,8 @@
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th class="table-col-grow">URL</th> <th class="table-col-grow">Target</th>
<th>Target</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
@ -54,13 +54,16 @@
{% for url in urls %} {% for url in urls %}
<tr> <tr>
<td>{{ url.id }}</td> <td>{{ url.id }}</td>
<td> <td class="table-col-grow-cell"><a href="{{ url.getURL() }}"><pre>{{ url.target_url }}</pre></a></td>
<div class="copyable-text"> <td class="actions">
<a class="content" href="{{ url.getURL() }}" target="_blank">{{ url.getURL() }}</a> <div>
<button class="copy-button"><i data-feather="copy"></i></button> <button class="copy-button" data-content="{{ url.getURL() }}"><i data-feather="copy"></i> <span class="tip">Copy URL</span></button>
</div> </div>
</td> </td>
<td><pre>{{ url.target_url }}</pre></td> </tr>
{% else %}
<tr>
<td colspan="3" class="center">You haven't shrunk any url yet.</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

1011
yarn.lock

File diff suppressed because it is too large Load Diff