refactor: some updates
This commit is contained in:
parent
4821c6455f
commit
a401afec1a
@ -25,7 +25,7 @@
|
||||
</td>
|
||||
<td class="small">
|
||||
<button
|
||||
class="action copy-clipboard"
|
||||
class="action"
|
||||
:aria-label="$t('buttons.copyToClipboard')"
|
||||
:title="$t('buttons.copyToClipboard')"
|
||||
@click="copyToClipboard(buildLink(link))"
|
||||
@ -35,12 +35,13 @@
|
||||
</td>
|
||||
<td class="small">
|
||||
<button
|
||||
class="action copy-clipboard"
|
||||
:aria-label="$t('buttons.copyInlineToClipboard')"
|
||||
:title="$t('buttons.copyInlineToClipboard')"
|
||||
@click="copyToClipboard(buildInlineLink(link))"
|
||||
class="action"
|
||||
:aria-label="$t('buttons.copyDownloadLinkToClipboard')"
|
||||
:title="$t('buttons.copyDownloadLinkToClipboard')"
|
||||
:disabled="!!link.password_hash"
|
||||
@click="copyToClipboard(buildDownloadLink(link))"
|
||||
>
|
||||
<i class="material-icons">insert_link</i>
|
||||
<i class="material-icons">content_paste_go</i>
|
||||
</button>
|
||||
</td>
|
||||
<td class="small">
|
||||
@ -143,7 +144,7 @@
|
||||
<script>
|
||||
import { mapActions, mapState } from "pinia";
|
||||
import { useFileStore } from "@/stores/file";
|
||||
import { share as api } from "@/api";
|
||||
import * as api from "@/api/index";
|
||||
import dayjs from "dayjs";
|
||||
import { useLayoutStore } from "@/stores/layout";
|
||||
import { copy } from "@/utils/clipboard";
|
||||
@ -184,7 +185,7 @@ export default {
|
||||
},
|
||||
async beforeMount() {
|
||||
try {
|
||||
const links = await api.get(this.url);
|
||||
const links = await api.share.get(this.url);
|
||||
this.links = links;
|
||||
this.sort();
|
||||
|
||||
@ -223,9 +224,14 @@ export default {
|
||||
let res = null;
|
||||
|
||||
if (!this.time) {
|
||||
res = await api.create(this.url, this.password);
|
||||
res = await api.share.create(this.url, this.password);
|
||||
} else {
|
||||
res = await api.create(this.url, this.password, this.time, this.unit);
|
||||
res = await api.share.create(
|
||||
this.url,
|
||||
this.password,
|
||||
this.time,
|
||||
this.unit
|
||||
);
|
||||
}
|
||||
|
||||
this.links.push(res);
|
||||
@ -243,7 +249,7 @@ export default {
|
||||
deleteLink: async function (event, link) {
|
||||
event.preventDefault();
|
||||
try {
|
||||
await api.remove(link.hash);
|
||||
await api.share.remove(link.hash);
|
||||
this.links = this.links.filter((item) => item.hash !== link.hash);
|
||||
|
||||
if (this.links.length == 0) {
|
||||
@ -257,10 +263,16 @@ export default {
|
||||
return dayjs(time * 1000).fromNow();
|
||||
},
|
||||
buildLink(share) {
|
||||
return api.getShareURL(share);
|
||||
return api.share.getShareURL(share);
|
||||
},
|
||||
buildInlineLink(share) {
|
||||
return createURL("api/public/dl/" + share.hash, { inline: "true" });
|
||||
buildDownloadLink(share) {
|
||||
return api.pub.getDownloadURL(
|
||||
{
|
||||
hash: share.hash,
|
||||
path: "",
|
||||
},
|
||||
true
|
||||
);
|
||||
},
|
||||
sort() {
|
||||
this.links = this.links.sort((a, b) => {
|
||||
|
||||
@ -98,7 +98,8 @@ main .spinner .bounce2 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.action.disabled {
|
||||
.action.disabled,
|
||||
.action[disabled] {
|
||||
opacity: 0.2;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
@ -460,4 +461,4 @@ html[dir="rtl"] .card-content .small + input {
|
||||
html[dir="rtl"] .card.floating .card-content .file-list {
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
"copy": "Copy",
|
||||
"copyFile": "Copy file",
|
||||
"copyToClipboard": "Copy to clipboard",
|
||||
"copyInlineToClipboard": "Copy inline link to clipboard",
|
||||
"copyDownloadLinkToClipboard": "Copy download link to clipboard",
|
||||
"create": "Create",
|
||||
"delete": "Delete",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user