feat: onlyoffice url config in settings

This commit is contained in:
DrosoCode 2021-05-31 13:56:58 +02:00
parent 75e82522fc
commit f140fe1ddf
9 changed files with 28 additions and 3 deletions

View File

@ -39,6 +39,7 @@ override the options.`,
DisableExternal: mustGetBool(flags, "branding.disableExternal"),
Files: mustGetString(flags, "branding.files"),
},
OnlyOffice: "",
}
ser := &settings.Server{

View File

@ -55,6 +55,8 @@ you want to change. Other options will remain unchanged.`,
set.Branding.DisableExternal = mustGetBool(flags, flag.Name)
case "branding.files":
set.Branding.Files = mustGetString(flags, flag.Name)
case "onlyoffice":
set.OnlyOffice = mustGetString(flags, flag.Name)
}
})

View File

@ -14,6 +14,7 @@ const theme = window.FileBrowser.Theme;
const enableThumbs = window.FileBrowser.EnableThumbs;
const resizePreview = window.FileBrowser.ResizePreview;
const enableExec = window.FileBrowser.EnableExec;
const onlyOffice = window.FileBrowser.OnlyOffice;
export {
name,
@ -31,4 +32,5 @@ export {
enableThumbs,
resizePreview,
enableExec,
onlyOffice,
};

View File

@ -22,6 +22,7 @@
<script>
import { files as api } from "@/api";
import { mapState, mapMutations } from "vuex";
import { onlyOffice } from "@/utils/constants";
import HeaderBar from "@/components/header/HeaderBar";
import Breadcrumbs from "@/components/Breadcrumbs";
@ -65,7 +66,7 @@ export default {
) {
return "editor";
} else if (
this.req.type === "officedocument"
this.req.type === "officedocument" && onlyOffice !== ""
) {
return "OnlyOfficeEditor";
} else {

View File

@ -21,7 +21,7 @@
<script>
import { mapState } from "vuex";
import url from "@/utils/url";
import { baseURL } from "@/utils/constants";
import { baseURL, onlyOffice } from "@/utils/constants";
import HeaderBar from "@/components/header/HeaderBar";
import Action from "@/components/header/Action";
@ -80,7 +80,7 @@ export default {
let onlyofficeScript = document.createElement("script");
onlyofficeScript.setAttribute(
"src",
`http://10.10.2.1:8765/web-apps/apps/api/documents/api.js`
`${onlyOffice}/web-apps/apps/api/documents/api.js`
);
document.head.appendChild(onlyofficeScript);

View File

@ -83,6 +83,20 @@
id="branding-files"
/>
</p>
<h3>{{ $t("settings.onlyOffice") }}</h3>
<p>
<label for="onlyoffice-url">{{
$t("settings.onlyOfficeUrl")
}}</label>
<input
class="input input--block"
type="text"
v-model="settings.onlyoffice"
id="onlyoffice-url"
/>
</p>
</div>
<div class="card-action">

View File

@ -16,6 +16,7 @@ type settingsData struct {
Branding settings.Branding `json:"branding"`
Shell []string `json:"shell"`
Commands map[string][]string `json:"commands"`
OnlyOffice string `json:"onlyoffice"`
}
var settingsGetHandler = withAdmin(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
@ -27,6 +28,7 @@ var settingsGetHandler = withAdmin(func(w http.ResponseWriter, r *http.Request,
Branding: d.settings.Branding,
Shell: d.settings.Shell,
Commands: d.settings.Commands,
OnlyOffice: d.settings.OnlyOffice,
}
return renderJSON(w, r, data)
@ -46,6 +48,7 @@ var settingsPutHandler = withAdmin(func(w http.ResponseWriter, r *http.Request,
d.settings.Branding = req.Branding
d.settings.Shell = req.Shell
d.settings.Commands = req.Commands
d.settings.OnlyOffice = req.OnlyOffice
err = d.store.Settings.Save(d.settings)
return errToStatus(err), err

View File

@ -42,6 +42,7 @@ func handleWithStaticData(w http.ResponseWriter, _ *http.Request, d *data, fSys
"EnableThumbs": d.server.EnableThumbnails,
"ResizePreview": d.server.ResizePreview,
"EnableExec": d.server.EnableExec,
"OnlyOffice": d.settings.OnlyOffice,
}
if d.settings.Branding.Files != "" {

View File

@ -21,6 +21,7 @@ type Settings struct {
Commands map[string][]string `json:"commands"`
Shell []string `json:"shell"`
Rules []rules.Rule `json:"rules"`
OnlyOffice string `json:"onlyoffice"`
}
// GetRules implements rules.Provider.