Skip to content

Commit

Permalink
feat: onlyoffice editor
Browse files Browse the repository at this point in the history
  • Loading branch information
drosoCode authored and Alan Castro committed Jan 22, 2024
1 parent 04e03a8 commit 0f39a34
Show file tree
Hide file tree
Showing 33 changed files with 878 additions and 1,357 deletions.
4 changes: 4 additions & 0 deletions cmd/config_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ override the options.`,
Theme: mustGetString(flags, "branding.theme"),
Files: mustGetString(flags, "branding.files"),
},
OnlyOffice: settings.OnlyOffice{
URL: mustGetString(flags, "onlyoffice.url"),
JWTSecret: mustGetString(flags, "onlyoffice.jwtSecret"),
},
}

ser := &settings.Server{
Expand Down
4 changes: 4 additions & 0 deletions cmd/config_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ you want to change. Other options will remain unchanged.`,
set.Branding.DisableUsedPercentage = mustGetBool(flags, flag.Name)
case "branding.files":
set.Branding.Files = mustGetString(flags, flag.Name)
case "onlyoffice.url":
set.OnlyOffice.URL = mustGetString(flags, flag.Name)
case "onlyoffice.jwtSecret":
set.OnlyOffice.JWTSecret = mustGetString(flags, flag.Name)
}
})

Expand Down
3 changes: 3 additions & 0 deletions files/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ func (i *FileInfo) detectType(modify, saveContent, readHeader bool) error {
i.Content = string(content)
}
return nil
case strings.HasPrefix(mimetype, "application/vnd.openxmlformats-officedocument"):
i.Type = "officedocument"
return nil
default:
i.Type = "blob"
}
Expand Down
1,872 changes: 533 additions & 1,339 deletions frontend/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"core-js": "^3.32.0",
"css-vars-ponyfill": "^2.4.8",
"filesize": "^10.0.8",
"jose": "^4.13.1",
"js-base64": "^3.7.5",
"lodash.clonedeep": "^4.5.0",
"lodash.throttle": "^4.1.1",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@
"newPassword": "كلمة المرور الجديدة",
"newPasswordConfirm": "تأكيد كلمة المرور",
"newUser": "مستخدم جديد",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "كلمة المرور",
"passwordUpdated": "تم تغيير كلمة المرور!",
"path": "المسار",
Expand Down Expand Up @@ -282,4 +284,3 @@
"unit": "وحدة الوقت"
}
}

4 changes: 3 additions & 1 deletion frontend/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@
"newPassword": "Ihr neues Passwort.",
"newPasswordConfirm": "Bestätigen Sie Ihr neues Passwort",
"newUser": "Neuer Benutzer",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Passwort",
"passwordUpdated": "Passwort aktualisiert!",
"path": "Pfad",
Expand Down Expand Up @@ -273,4 +275,4 @@
"seconds": "Sekunden",
"unit": "Zeiteinheit"
}
}
}
5 changes: 4 additions & 1 deletion frontend/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@
"newPassword": "Your new password",
"newPasswordConfirm": "Confirm your new password",
"newUser": "New User",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"onlyOfficeJwtSecret": "Only Office JWT Secret (works only with https, leave blank to disable)",
"password": "Password",
"passwordUpdated": "Password updated!",
"path": "Path",
Expand Down Expand Up @@ -282,4 +285,4 @@
"seconds": "Seconds",
"unit": "Time Unit"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@
"newPassword": "Tu nueva contraseña",
"newPasswordConfirm": "Confirma tu contraseña",
"newUser": "Nuevo usuario",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Contraseña",
"passwordUpdated": "¡Contraseña actualizada!",
"path": "Ruta",
Expand Down Expand Up @@ -271,4 +273,4 @@
"seconds": "Segundos",
"unit": "Unidad"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@
"newPassword": "Votre nouveau mot de passe",
"newPasswordConfirm": "Confirmation du nouveau mot de passe",
"newUser": "Nouvel Utilisateur",
"onlyOffice": "Intégration Only Office",
"onlyOfficeUrl": "URL vers OnlyOffice (laisser vide pour désactiver)",
"password": "Mot de passe",
"passwordUpdated": "Mot de passe mis à jour !",
"path": "",
Expand Down Expand Up @@ -268,4 +270,4 @@
"seconds": "Secondes",
"unit": "Unité de temps"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/is.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"newPassword": "Nýja lykilorðið þitt",
"newPasswordConfirm": "Staðfestu nýja lykilorðið",
"newUser": "Nýr notandi",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Lykilorð",
"passwordUpdated": "Lykilorð vistað!",
"path": "",
Expand Down Expand Up @@ -257,4 +259,4 @@
"seconds": "Sekúndur",
"unit": "Tímastilling"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"newPassword": "La tua nuova password",
"newPasswordConfirm": "Conferma la password",
"newUser": "Nuovo utente",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Password",
"passwordUpdated": "Password aggiornata!",
"path": "Percorso",
Expand Down Expand Up @@ -257,4 +259,4 @@
"seconds": "Secondi",
"unit": "Unità di tempo"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"newPassword": "新しいパスワード",
"newPasswordConfirm": "新しいパスワードを確認します",
"newUser": "新しいユーザー",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "パスワード",
"passwordUpdated": "パスワードは更新されました!",
"path": "",
Expand Down Expand Up @@ -257,4 +259,4 @@
"seconds": "",
"unit": "時間単位"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"newPassword": "새로운 비밀번호",
"newPasswordConfirm": "새로운 비밀번호 확인",
"newUser": "새로운 사용자",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "비밀번호",
"passwordUpdated": "비밀번호 수정 완료!",
"path": "",
Expand Down Expand Up @@ -257,4 +259,4 @@
"seconds": "",
"unit": "Time Unit"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/nl-be.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"newPassword": "Uw nieuw wachtwoord",
"newPasswordConfirm": "Bevestig uw nieuw wachtwoord",
"newUser": "Nieuwe gebruiker",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Wachtwoord",
"passwordUpdated": "Wachtwoord bijgewerkt!",
"path": "",
Expand Down Expand Up @@ -257,4 +259,4 @@
"seconds": "Seconden",
"unit": "Tijdseenheid"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@
"newPassword": "Twoje nowe hasło",
"newPasswordConfirm": "Potwierdź swoje hasło",
"newUser": "Nowy Użytkownik",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Hasło",
"passwordUpdated": "Hasło zostało zapisane!",
"path": "Ścieżka",
Expand Down Expand Up @@ -258,4 +260,4 @@
"seconds": "Sekundy",
"unit": "Jednostka czasu"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@
"newPassword": "Nova senha",
"newPasswordConfirm": "Confirme a nova senha",
"newUser": "Novo usuário",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Senha",
"passwordUpdated": "Senha atualizada!",
"path": "",
Expand Down Expand Up @@ -271,4 +273,4 @@
"seconds": "Segundos",
"unit": "Unidades de Tempo"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"newPassword": "Nova palavra-passe",
"newPasswordConfirm": "Confirme a nova palavra-passe",
"newUser": "Novo utilizador",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Palavra-passe",
"passwordUpdated": "Palavra-passe atualizada!",
"path": "",
Expand Down Expand Up @@ -257,4 +259,4 @@
"seconds": "Segundos",
"unit": "Unidades de tempo"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"newPassword": "Noua ta parolă",
"newPasswordConfirm": "Confirmă noua parolă",
"newUser": "Utilizator nou",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Parola",
"passwordUpdated": "Parola actualizată!",
"path": "",
Expand Down Expand Up @@ -257,4 +259,4 @@
"seconds": "Secunde",
"unit": "Unitate de timp"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@
"newPassword": "Новый пароль",
"newPasswordConfirm": "Повтор нового пароля",
"newUser": "Новый пользователь",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Пароль",
"passwordUpdated": "Пароль обновлен!",
"path": "Путь",
Expand Down Expand Up @@ -267,4 +269,4 @@
"seconds": "Секунды",
"unit": "Единица времени"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/sv-se.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"newPassword": "Ditt nya lösenord",
"newPasswordConfirm": "Bekräfta ditt nya lösenord",
"newUser": "Ny användare",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "Lösenord",
"passwordUpdated": "Lösenord uppdaterat",
"path": "",
Expand Down Expand Up @@ -257,4 +259,4 @@
"seconds": "Sekunder",
"unit": "Tidsenhet"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@
"newPassword": "你的新密码",
"newPasswordConfirm": "再次输入以确认你的新密码",
"newUser": "新建用户",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "密码",
"passwordUpdated": "密码已更新!",
"path": "路径",
Expand Down Expand Up @@ -282,4 +284,4 @@
"seconds": "",
"unit": "时间单位"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
"newPassword": "您的新密碼",
"newPasswordConfirm": "重輸一遍新密碼",
"newUser": "建立使用者",
"onlyOffice": "Only Office Integration",
"onlyOfficeUrl": "Only Office URL (leave blank to disable)",
"password": "密碼",
"passwordUpdated": "密碼已更新!",
"path": "",
Expand Down Expand Up @@ -257,4 +259,4 @@
"seconds": "",
"unit": "時間單位"
}
}
}
2 changes: 2 additions & 0 deletions frontend/src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const enableExec = window.FileBrowser.EnableExec;
const tusSettings = window.FileBrowser.TusSettings;
const origin = window.location.origin;
const tusEndpoint = `/api/tus`;
const onlyOffice = window.FileBrowser.OnlyOffice;

export {
name,
Expand All @@ -39,4 +40,5 @@ export {
tusSettings,
origin,
tusEndpoint,
onlyOffice,
};
4 changes: 4 additions & 0 deletions frontend/src/views/Files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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.vue";
import Breadcrumbs from "@/components/Breadcrumbs.vue";
Expand All @@ -42,6 +43,7 @@ export default {
Preview,
Listing,
Editor: () => import("@/views/files/Editor.vue"),
OnlyOfficeEditor: () => import("@/views/files/OnlyOfficeEditor.vue"),
},
data: function () {
return {
Expand All @@ -63,6 +65,8 @@ export default {
this.req.type === "textImmutable"
) {
return "editor";
} else if (this.req.type === "officedocument" && onlyOffice !== "") {
return "OnlyOfficeEditor";
} else {
return "preview";
}
Expand Down
Loading

0 comments on commit 0f39a34

Please sign in to comment.