Merge remote-tracking branch 'upstream/master' into feature/jwt-header-auth
This commit is contained in:
commit
aedd3fc72e
26
.github/workflows/main.yaml
vendored
26
.github/workflows/main.yaml
vendored
@ -13,26 +13,26 @@ jobs:
|
|||||||
lint-frontend:
|
lint-frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '18'
|
||||||
- run: make lint-frontend
|
- run: make lint-frontend
|
||||||
lint-backend:
|
lint-backend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.0
|
go-version: 1.21.0
|
||||||
- run: make lint-backend
|
- run: make lint-backend
|
||||||
lint-commits:
|
lint-commits:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '18'
|
||||||
- run: make lint-commits
|
- run: make lint-commits
|
||||||
@ -46,16 +46,16 @@ jobs:
|
|||||||
test-frontend:
|
test-frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '18'
|
||||||
- run: make test-frontend
|
- run: make test-frontend
|
||||||
test-backend:
|
test-backend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.0
|
go-version: 1.21.0
|
||||||
- run: make test-backend
|
- run: make test-backend
|
||||||
@ -71,13 +71,13 @@ jobs:
|
|||||||
needs: [lint, test]
|
needs: [lint, test]
|
||||||
if: startsWith(github.event.ref, 'refs/tags/v')
|
if: startsWith(github.event.ref, 'refs/tags/v')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.0
|
go-version: 1.21.0
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '18'
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
|
|||||||
11
cmd/utils.go
11
cmd/utils.go
@ -87,16 +87,23 @@ func python(fn pythonFunc, cfg pythonConfig) cobraFunc {
|
|||||||
data := pythonData{hadDB: true}
|
data := pythonData{hadDB: true}
|
||||||
|
|
||||||
path := getParam(cmd.Flags(), "database")
|
path := getParam(cmd.Flags(), "database")
|
||||||
|
absPath, err := filepath.Abs(path)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
exists, err := dbExists(path)
|
exists, err := dbExists(path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
} else if exists && cfg.noDB {
|
} else if exists && cfg.noDB {
|
||||||
log.Fatal(path + " already exists")
|
log.Fatal(absPath + " already exists")
|
||||||
} else if !exists && !cfg.noDB && !cfg.allowNoDB {
|
} else if !exists && !cfg.noDB && !cfg.allowNoDB {
|
||||||
log.Fatal(path + " does not exist. Please run 'filebrowser config init' first.")
|
log.Fatal(absPath + " does not exist. Please run 'filebrowser config init' first.")
|
||||||
|
} else if !exists && !cfg.noDB {
|
||||||
|
log.Println("Warning: filebrowser.db can't be found. Initialing in " + strings.TrimSuffix(absPath, "filebrowser.db"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Println("Using database: " + absPath)
|
||||||
data.hadDB = exists
|
data.hadDB = exists
|
||||||
db, err := storm.Open(path)
|
db, err := storm.Open(path)
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
|||||||
@ -16,6 +16,8 @@
|
|||||||
[{[ if .Name -]}][{[ .Name ]}][{[ else ]}]File Browser[{[ end ]}]
|
[{[ if .Name -]}][{[ .Name ]}][{[ else ]}]File Browser[{[ end ]}]
|
||||||
</title>
|
</title>
|
||||||
|
|
||||||
|
<meta name="robots" content="noindex,nofollow">
|
||||||
|
|
||||||
<link
|
<link
|
||||||
rel="icon"
|
rel="icon"
|
||||||
type="image/png"
|
type="image/png"
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
class="shell"
|
class="shell"
|
||||||
:class="{ ['shell--hidden']: !showShell }"
|
:class="{ ['shell--hidden']: !showShell }"
|
||||||
:style="{ height: `${this.shellHeight}em` }"
|
:style="{ height: `${this.shellHeight}em`, direction: 'ltr' }"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@pointerdown="startDrag()"
|
@pointerdown="startDrag()"
|
||||||
|
|||||||
@ -191,7 +191,12 @@ export default {
|
|||||||
action(overwrite, rename);
|
action(overwrite, rename);
|
||||||
},
|
},
|
||||||
itemClick: function (event) {
|
itemClick: function (event) {
|
||||||
if (!(event.ctrlKey || event.metaKey) && this.singleClick && !this.$store.state.multiple) this.open();
|
if (
|
||||||
|
!(event.ctrlKey || event.metaKey) &&
|
||||||
|
this.singleClick &&
|
||||||
|
!this.$store.state.multiple
|
||||||
|
)
|
||||||
|
this.open();
|
||||||
else this.click(event);
|
else this.click(event);
|
||||||
},
|
},
|
||||||
click: function (event) {
|
click: function (event) {
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
class="card-action"
|
class="card-action"
|
||||||
style="display: flex; align-items: center; justify-content: space-between;"
|
style="display: flex; align-items: center; justify-content: space-between"
|
||||||
>
|
>
|
||||||
<template v-if="user.perm.create">
|
<template v-if="user.perm.create">
|
||||||
<button
|
<button
|
||||||
@ -20,7 +20,7 @@
|
|||||||
@click="$refs.fileList.createDir()"
|
@click="$refs.fileList.createDir()"
|
||||||
:aria-label="$t('sidebar.newFolder')"
|
:aria-label="$t('sidebar.newFolder')"
|
||||||
:title="$t('sidebar.newFolder')"
|
:title="$t('sidebar.newFolder')"
|
||||||
style="justify-self: left;"
|
style="justify-self: left"
|
||||||
>
|
>
|
||||||
<span>{{ $t("sidebar.newFolder") }}</span>
|
<span>{{ $t("sidebar.newFolder") }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -45,6 +45,7 @@ export default {
|
|||||||
submit: async function () {
|
submit: async function () {
|
||||||
buttons.loading("delete");
|
buttons.loading("delete");
|
||||||
|
|
||||||
|
window.sessionStorage.setItem("modified", "true");
|
||||||
try {
|
try {
|
||||||
if (!this.isListing) {
|
if (!this.isListing) {
|
||||||
await api.remove(this.$route.path);
|
await api.remove(this.$route.path);
|
||||||
|
|||||||
@ -133,14 +133,13 @@ export default {
|
|||||||
: this.req.items[this.selected[0]].isDir)
|
: this.req.items[this.selected[0]].isDir)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
resolution: function() {
|
resolution: function () {
|
||||||
if (this.selectedCount === 1) {
|
if (this.selectedCount === 1) {
|
||||||
const selectedItem = this.req.items[this.selected[0]];
|
const selectedItem = this.req.items[this.selected[0]];
|
||||||
if (selectedItem && selectedItem.type === 'image') {
|
if (selectedItem && selectedItem.type === "image") {
|
||||||
return selectedItem.resolution;
|
return selectedItem.resolution;
|
||||||
}
|
}
|
||||||
}
|
} else if (this.req && this.req.type === "image") {
|
||||||
else if (this.req && this.req.type === 'image') {
|
|
||||||
return this.req.resolution;
|
return this.req.resolution;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
class="card-action"
|
class="card-action"
|
||||||
style="display: flex; align-items: center; justify-content: space-between;"
|
style="display: flex; align-items: center; justify-content: space-between"
|
||||||
>
|
>
|
||||||
<template v-if="user.perm.create">
|
<template v-if="user.perm.create">
|
||||||
<button
|
<button
|
||||||
@ -19,7 +19,7 @@
|
|||||||
@click="$refs.fileList.createDir()"
|
@click="$refs.fileList.createDir()"
|
||||||
:aria-label="$t('sidebar.newFolder')"
|
:aria-label="$t('sidebar.newFolder')"
|
||||||
:title="$t('sidebar.newFolder')"
|
:title="$t('sidebar.newFolder')"
|
||||||
style="justify-self: left;"
|
style="justify-self: left"
|
||||||
>
|
>
|
||||||
<span>{{ $t("sidebar.newFolder") }}</span>
|
<span>{{ $t("sidebar.newFolder") }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -88,6 +88,7 @@ export default {
|
|||||||
newLink =
|
newLink =
|
||||||
url.removeLastDir(oldLink) + "/" + encodeURIComponent(this.name);
|
url.removeLastDir(oldLink) + "/" + encodeURIComponent(this.name);
|
||||||
|
|
||||||
|
window.sessionStorage.setItem("modified", "true");
|
||||||
try {
|
try {
|
||||||
await api.move([{ from: oldLink, to: newLink }]);
|
await api.move([{ from: oldLink, to: newLink }]);
|
||||||
if (!this.isListing) {
|
if (!this.isListing) {
|
||||||
|
|||||||
@ -2,10 +2,6 @@
|
|||||||
nav {
|
nav {
|
||||||
width: 10em
|
width: 10em
|
||||||
}
|
}
|
||||||
/* Mobile Only fix div hidden by bottom navigation bar of mobile browser when using height: 100vh */
|
|
||||||
#previewer .preview {
|
|
||||||
height: calc(100% - 4em) !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1024px) {
|
@media (max-width: 1024px) {
|
||||||
|
|||||||
@ -152,8 +152,7 @@ main .spinner .bounce2 {
|
|||||||
/* PREVIEWER */
|
/* PREVIEWER */
|
||||||
|
|
||||||
#previewer {
|
#previewer {
|
||||||
background-color: rgba(0, 0, 0, 0.9);
|
background-color: rgba(0, 0, 0, 0.99);
|
||||||
padding-top: 4em;
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@ -166,15 +165,25 @@ main .spinner .bounce2 {
|
|||||||
#previewer header {
|
#previewer header {
|
||||||
background: none;
|
background: none;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
border-bottom: 0px;
|
||||||
|
box-shadow: 0px 0px 0px;
|
||||||
|
z-index: 19999;
|
||||||
}
|
}
|
||||||
|
|
||||||
#previewer header > .action i {
|
#previewer header > .action i {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
text-shadow: 1px 1px 1px #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#previewer header > title {
|
||||||
|
white-space: nowrap;
|
||||||
|
text-shadow: 1px 1px 1px #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 738px) {
|
@media (min-width: 738px) {
|
||||||
#previewer header #dropdown .action i {
|
#previewer header #dropdown .action i {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
text-shadow: 1px 1px 1px #000000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +197,7 @@ main .spinner .bounce2 {
|
|||||||
|
|
||||||
#previewer .preview {
|
#previewer .preview {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
height: calc(100vh - 4em);
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#previewer .preview pre {
|
#previewer .preview pre {
|
||||||
@ -203,6 +212,12 @@ main .spinner .bounce2 {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#previewer .preview audio {
|
||||||
|
width: 95%;
|
||||||
|
height: 88%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#previewer .preview video {
|
#previewer .preview video {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
@ -247,7 +262,7 @@ main .spinner .bounce2 {
|
|||||||
#previewer > button {
|
#previewer > button {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: calc(50% + 1.85em);
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
background-color: rgba(80, 80, 80, 0.5);
|
background-color: rgba(80, 80, 80, 0.5);
|
||||||
color: white;
|
color: white;
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
<header-bar v-if="error || req.type == null" showMenu showLogo />
|
<header-bar v-if="error || req.type == null" showMenu showLogo />
|
||||||
|
|
||||||
<breadcrumbs base="/files" />
|
<breadcrumbs base="/files" />
|
||||||
|
<listing />
|
||||||
<errors v-if="error" :errorCode="error.status" />
|
<errors v-if="error" :errorCode="error.status" />
|
||||||
<component v-else-if="currentView" :is="currentView"></component>
|
<component v-else-if="currentView" :is="currentView"></component>
|
||||||
<div v-else>
|
<div v-else-if="currentView !== null">
|
||||||
<h2 class="message delayed">
|
<h2 class="message delayed">
|
||||||
<div class="spinner">
|
<div class="spinner">
|
||||||
<div class="bounce1"></div>
|
<div class="bounce1"></div>
|
||||||
@ -52,12 +52,8 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState(["req", "reload", "loading"]),
|
...mapState(["req", "reload", "loading"]),
|
||||||
currentView() {
|
currentView() {
|
||||||
if (this.req.type == undefined) {
|
if (this.req.type == undefined || this.req.isDir) {
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
if (this.req.isDir) {
|
|
||||||
return "listing";
|
|
||||||
} else if (
|
} else if (
|
||||||
this.req.type === "text" ||
|
this.req.type === "text" ||
|
||||||
this.req.type === "textImmutable"
|
this.req.type === "textImmutable"
|
||||||
@ -72,7 +68,26 @@ export default {
|
|||||||
this.fetchData();
|
this.fetchData();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route: "fetchData",
|
$route: function (to, from) {
|
||||||
|
if (from.path.endsWith("/")) {
|
||||||
|
if (to.path.endsWith("/")) {
|
||||||
|
window.sessionStorage.setItem("listFrozen", "false");
|
||||||
|
this.fetchData();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
window.sessionStorage.setItem("listFrozen", "true");
|
||||||
|
this.fetchData();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (to.path.endsWith("/")) {
|
||||||
|
this.$store.commit("updateRequest", {});
|
||||||
|
this.fetchData();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.fetchData();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
reload: function (value) {
|
reload: function (value) {
|
||||||
if (value === true) {
|
if (value === true) {
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
@ -101,7 +116,9 @@ export default {
|
|||||||
this.$store.commit("closeHovers");
|
this.$store.commit("closeHovers");
|
||||||
|
|
||||||
// Set loading to true and reset the error.
|
// Set loading to true and reset the error.
|
||||||
this.setLoading(true);
|
if (window.sessionStorage.getItem("listFrozen") !=="true" && window.sessionStorage.getItem("modified") !=="true"){
|
||||||
|
this.setLoading(true);
|
||||||
|
}
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
let url = this.$route.path;
|
let url = this.$route.path;
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
<breadcrumbs :base="'/share/' + hash" />
|
<breadcrumbs :base="'/share/' + hash" />
|
||||||
|
|
||||||
<div v-if="loading">
|
<div v-if="loading">
|
||||||
<h2 class="message delayed">
|
<h2 class="message delayed" style="padding-top: 3em !important;">
|
||||||
<div class="spinner">
|
<div class="spinner">
|
||||||
<div class="bounce1"></div>
|
<div class="bounce1"></div>
|
||||||
<div class="bounce2"></div>
|
<div class="bounce2"></div>
|
||||||
@ -73,28 +73,34 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div class="share">
|
<div class="share">
|
||||||
<div class="share__box share__box__info">
|
<div class="share__box share__box__info"
|
||||||
<div class="share__box__header">
|
style="
|
||||||
|
position: -webkit-sticky;
|
||||||
|
position: sticky;
|
||||||
|
top:-20.6em;
|
||||||
|
z-index:999;"
|
||||||
|
>
|
||||||
|
<div class="share__box__header" style="height:3em">
|
||||||
{{
|
{{
|
||||||
req.isDir
|
req.isDir
|
||||||
? $t("download.downloadFolder")
|
? $t("download.downloadFolder")
|
||||||
: $t("download.downloadFile")
|
: $t("download.downloadFile")
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
<div class="share__box__element share__box__center share__box__icon">
|
<div v-if="!this.req.isDir" class="share__box__element share__box__center share__box__icon">
|
||||||
<i class="material-icons">{{ icon }}</i>
|
<i class="material-icons">{{ icon }}</i>
|
||||||
</div>
|
</div>
|
||||||
<div class="share__box__element">
|
<div class="share__box__element" style="height:3em">
|
||||||
<strong>{{ $t("prompts.displayName") }}</strong> {{ req.name }}
|
<strong>{{ $t("prompts.displayName") }}</strong> {{ req.name }}
|
||||||
</div>
|
</div>
|
||||||
<div class="share__box__element" :title="modTime">
|
<div v-if="!this.req.isDir" class="share__box__element" :title="modTime">
|
||||||
<strong>{{ $t("prompts.lastModified") }}:</strong> {{ humanTime }}
|
<strong>{{ $t("prompts.lastModified") }}:</strong> {{ humanTime }}
|
||||||
</div>
|
</div>
|
||||||
<div class="share__box__element">
|
<div class="share__box__element" style="height:3em">
|
||||||
<strong>{{ $t("prompts.size") }}:</strong> {{ humanSize }}
|
<strong>{{ $t("prompts.size") }}:</strong> {{ humanSize }}
|
||||||
</div>
|
</div>
|
||||||
<div class="share__box__element share__box__center">
|
<div class="share__box__element share__box__center">
|
||||||
<a target="_blank" :href="link" class="button button--flat">
|
<a target="_blank" :href="link" class="button button--flat" style="height:4em">
|
||||||
<div>
|
<div>
|
||||||
<i class="material-icons">file_download</i
|
<i class="material-icons">file_download</i
|
||||||
>{{ $t("buttons.download") }}
|
>{{ $t("buttons.download") }}
|
||||||
@ -111,12 +117,73 @@
|
|||||||
>{{ $t("buttons.openFile") }}
|
>{{ $t("buttons.openFile") }}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
<qrcode-vue v-if="this.req.isDir" :value="fullLink" size="100" level="M"></qrcode-vue>
|
||||||
</div>
|
</div>
|
||||||
<div class="share__box__element share__box__center">
|
<div v-if="!this.req.isDir" class="share__box__element share__box__center">
|
||||||
<qrcode-vue :value="link" size="200" level="M"></qrcode-vue>
|
<qrcode-vue :value="link" size="200" level="M"></qrcode-vue>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="this.req.isDir" class="share__box__element share__box__header" style="height:3em">
|
||||||
|
{{ $t("sidebar.preview") }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="this.req.isDir"
|
||||||
|
class="share__box__element share__box__center share__box__icon"
|
||||||
|
style="padding:0em !important;height:12em !important;"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
target="_blank"
|
||||||
|
:href="raw"
|
||||||
|
class="button button--flat"
|
||||||
|
v-if= "!this.$store.state.multiple &&
|
||||||
|
selectedCount === 1 &&
|
||||||
|
req.items[this.selected[0]].type === 'image'"
|
||||||
|
style="height: 12em; padding:0; margin:0;"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
style="height: 12em;"
|
||||||
|
:src="raw"
|
||||||
|
>
|
||||||
|
</a>
|
||||||
|
<div
|
||||||
|
v-else-if= "
|
||||||
|
!this.$store.state.multiple &&
|
||||||
|
selectedCount === 1 &&
|
||||||
|
req.items[this.selected[0]].type === 'audio'"
|
||||||
|
style="height: 12em; paddingTop:1em; margin:0;"
|
||||||
|
>
|
||||||
|
<button @click="play" v-if="!this.tag" style="fontSize:6em !important; border:0px;outline:none; background: white;" class="material-icons">play_circle_filled</button>
|
||||||
|
<button @click="play" v-if="this.tag" style="fontSize:6em !important; border:0px;outline:none; background: white;" class="material-icons">pause_circle_filled</button>
|
||||||
|
<audio id="myaudio"
|
||||||
|
:src="raw"
|
||||||
|
controls="controls"
|
||||||
|
:autoplay="tag"
|
||||||
|
>
|
||||||
|
</audio>
|
||||||
|
</div>
|
||||||
|
<video
|
||||||
|
v-else-if= "
|
||||||
|
!this.$store.state.multiple &&
|
||||||
|
selectedCount === 1 &&
|
||||||
|
req.items[this.selected[0]].type === 'video'"
|
||||||
|
style="height: 12em; padding:0; margin:0;"
|
||||||
|
:src="raw"
|
||||||
|
controls="controls"
|
||||||
|
>
|
||||||
|
Sorry, your browser doesn't support embedded videos, but don't worry,
|
||||||
|
you can <a :href="raw">download it</a>
|
||||||
|
and watch it with your favorite video player!
|
||||||
|
</video>
|
||||||
|
<i
|
||||||
|
v-else-if= "
|
||||||
|
!this.$store.state.multiple &&
|
||||||
|
selectedCount === 1 &&
|
||||||
|
req.items[this.selected[0]].isDir"
|
||||||
|
class="material-icons">folder
|
||||||
|
</i>
|
||||||
|
<i v-else class="material-icons">call_to_action</i>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div id="shareList"
|
||||||
v-if="req.isDir && req.items.length > 0"
|
v-if="req.isDir && req.items.length > 0"
|
||||||
class="share__box share__box__items"
|
class="share__box share__box__items"
|
||||||
>
|
>
|
||||||
@ -211,6 +278,7 @@ export default {
|
|||||||
hash: null,
|
hash: null,
|
||||||
token: null,
|
token: null,
|
||||||
clip: null,
|
clip: null,
|
||||||
|
tag: false,
|
||||||
}),
|
}),
|
||||||
watch: {
|
watch: {
|
||||||
$route: function () {
|
$route: function () {
|
||||||
@ -248,6 +316,9 @@ export default {
|
|||||||
link: function () {
|
link: function () {
|
||||||
return api.getDownloadURL(this.req);
|
return api.getDownloadURL(this.req);
|
||||||
},
|
},
|
||||||
|
raw: function () {
|
||||||
|
return this.req.items[this.selected[0]].url.replace(/share/, 'api/public/dl')+'?token='+this.token;
|
||||||
|
},
|
||||||
inlineLink: function () {
|
inlineLink: function () {
|
||||||
return api.getDownloadURL(this.req, true);
|
return api.getDownloadURL(this.req, true);
|
||||||
},
|
},
|
||||||
@ -270,6 +341,16 @@ export default {
|
|||||||
base64: function (name) {
|
base64: function (name) {
|
||||||
return window.btoa(unescape(encodeURIComponent(name)));
|
return window.btoa(unescape(encodeURIComponent(name)));
|
||||||
},
|
},
|
||||||
|
play() {
|
||||||
|
var audio = document.getElementById('myaudio');
|
||||||
|
if(this.tag){
|
||||||
|
audio.pause();
|
||||||
|
this.tag = false;
|
||||||
|
} else {
|
||||||
|
audio.play();
|
||||||
|
this.tag = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
fetchData: async function () {
|
fetchData: async function () {
|
||||||
// Reset view information.
|
// Reset view information.
|
||||||
this.$store.commit("setReload", false);
|
this.$store.commit("setReload", false);
|
||||||
@ -358,3 +439,17 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
#listing.list{
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
#shareList{
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
@media (min-width: 930px) {
|
||||||
|
#shareList{
|
||||||
|
height: calc(100vh - 9.8em);
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="editor-container">
|
<div
|
||||||
|
id="editor-container"
|
||||||
|
@touchmove.prevent.stop
|
||||||
|
@wheel.prevent.stop
|
||||||
|
>
|
||||||
<header-bar>
|
<header-bar>
|
||||||
<action icon="close" :label="$t('buttons.close')" @action="close()" />
|
<action icon="close" :label="$t('buttons.close')" @action="close()" />
|
||||||
<title>{{ req.name }}</title>
|
<title>{{ req.name }}</title>
|
||||||
@ -129,6 +133,7 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await api.put(this.$route.path, this.editor.getValue());
|
await api.put(this.$route.path, this.editor.getValue());
|
||||||
|
this.editor.session.getUndoManager().markClean();
|
||||||
buttons.success(button);
|
buttons.success(button);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
buttons.done(button);
|
buttons.done(button);
|
||||||
@ -136,9 +141,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
const originalContent = this.req.content;
|
if (!this.editor.session.getUndoManager().isClean()) {
|
||||||
const currentContent = this.editor.getValue();
|
|
||||||
if (originalContent !== currentContent) {
|
|
||||||
this.$store.commit("showHover", "discardEditorChanges");
|
this.$store.commit("showHover", "discardEditorChanges");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -383,17 +383,23 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
req: function () {
|
req: function () {
|
||||||
// Reset the show value
|
if (window.sessionStorage.getItem("listFrozen") !=="true" && window.sessionStorage.getItem("modified") !=="true"){
|
||||||
this.showLimit = 50;
|
// Reset the show value
|
||||||
|
this.showLimit = 50;
|
||||||
|
|
||||||
// Ensures that the listing is displayed
|
// Ensures that the listing is displayed
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
// How much every listing item affects the window height
|
// How much every listing item affects the window height
|
||||||
this.setItemWeight();
|
this.setItemWeight();
|
||||||
|
|
||||||
// Fill and fit the window with listing items
|
// Fill and fit the window with listing items
|
||||||
this.fillWindow(true);
|
this.fillWindow(true);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
if (this.req.isDir) {
|
||||||
|
window.sessionStorage.setItem("listFrozen", "false");
|
||||||
|
window.sessionStorage.setItem("modified", "false");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
id="previewer"
|
id="previewer"
|
||||||
|
@touchmove.prevent.stop
|
||||||
|
@wheel.prevent.stop
|
||||||
@mousemove="toggleNavigation"
|
@mousemove="toggleNavigation"
|
||||||
@touchstart="toggleNavigation"
|
@touchstart="toggleNavigation"
|
||||||
>
|
>
|
||||||
<header-bar>
|
<header-bar v-if="showNav">
|
||||||
<action icon="close" :label="$t('buttons.close')" @action="close()" />
|
<action icon="close" :label="$t('buttons.close')" @action="close()" />
|
||||||
<title>{{ name }}</title>
|
<title>{{ name }}</title>
|
||||||
<action
|
<action
|
||||||
|
|||||||
2
go.mod
2
go.mod
@ -65,7 +65,7 @@ require (
|
|||||||
golang.org/x/oauth2 v0.13.0 // indirect
|
golang.org/x/oauth2 v0.13.0 // indirect
|
||||||
golang.org/x/sys v0.15.0 // indirect
|
golang.org/x/sys v0.15.0 // indirect
|
||||||
google.golang.org/appengine v1.6.8 // indirect
|
google.golang.org/appengine v1.6.8 // indirect
|
||||||
google.golang.org/protobuf v1.31.0 // indirect
|
google.golang.org/protobuf v1.33.0 // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
|||||||
4
go.sum
4
go.sum
@ -606,8 +606,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
|
|||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
|||||||
@ -173,7 +173,7 @@ require (
|
|||||||
golang.org/x/sync v0.3.0 // indirect
|
golang.org/x/sync v0.3.0 // indirect
|
||||||
golang.org/x/sys v0.10.0 // indirect
|
golang.org/x/sys v0.10.0 // indirect
|
||||||
golang.org/x/text v0.9.0 // indirect
|
golang.org/x/text v0.9.0 // indirect
|
||||||
google.golang.org/protobuf v1.28.0 // indirect
|
google.golang.org/protobuf v1.33.0 // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
|||||||
@ -934,8 +934,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
|
|||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user