feat: onlyoffice url config in settings

This commit is contained in:
DrosoCode 2021-05-31 13:56:58 +02:00 committed by Dimanda
parent c52983eb97
commit 34677d5b5c
9 changed files with 28 additions and 3 deletions

View File

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

View File

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

View File

@ -15,6 +15,7 @@ const enableThumbs = window.FileBrowser.EnableThumbs;
const resizePreview = window.FileBrowser.ResizePreview; const resizePreview = window.FileBrowser.ResizePreview;
const enableExec = window.FileBrowser.EnableExec; const enableExec = window.FileBrowser.EnableExec;
const origin = window.location.origin; const origin = window.location.origin;
const onlyOffice = window.FileBrowser.OnlyOffice;
export { export {
name, name,
@ -33,4 +34,5 @@ export {
resizePreview, resizePreview,
enableExec, enableExec,
origin, origin,
onlyOffice,
}; };

View File

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

View File

@ -21,7 +21,7 @@
<script> <script>
import { mapState } from "vuex"; import { mapState } from "vuex";
import url from "@/utils/url"; import url from "@/utils/url";
import { baseURL } from "@/utils/constants"; import { baseURL, onlyOffice } from "@/utils/constants";
import HeaderBar from "@/components/header/HeaderBar"; import HeaderBar from "@/components/header/HeaderBar";
import Action from "@/components/header/Action"; import Action from "@/components/header/Action";
@ -80,7 +80,7 @@ export default {
let onlyofficeScript = document.createElement("script"); let onlyofficeScript = document.createElement("script");
onlyofficeScript.setAttribute( onlyofficeScript.setAttribute(
"src", "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); document.head.appendChild(onlyofficeScript);

View File

@ -92,6 +92,20 @@
id="branding-files" id="branding-files"
/> />
</p> </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>
<div class="card-action"> <div class="card-action">

View File

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

View File

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

View File

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