Add internal access URL (hopefully)

multihost_notor
Skylar Ittner 7 years ago
parent d5478678a7
commit 6ff27cb17f

@ -5,7 +5,7 @@
<description>Collabora Online allows you to to work with all kinds of office documents directly in your browser. This application requires Collabora Cloudsuite to be installed on one of your servers, please read the documentation to learn more about that.</description> <description>Collabora Online allows you to to work with all kinds of office documents directly in your browser. This application requires Collabora Cloudsuite to be installed on one of your servers, please read the documentation to learn more about that.</description>
<summary>Edit office documents directly in your browser.</summary> <summary>Edit office documents directly in your browser.</summary>
<licence>AGPL</licence> <licence>AGPL</licence>
<version>1.12.34</version> <version>1.12.34_dontsellme</version>
<author>Collabora Productivity based on work of Frank Karlitschek, Victor Dubiniuk</author> <author>Collabora Productivity based on work of Frank Karlitschek, Victor Dubiniuk</author>
<bugs>https://github.com/nextcloud/richdocuments/issues</bugs> <bugs>https://github.com/nextcloud/richdocuments/issues</bugs>
<repository type="git">https://github.com/nextcloud/richdocuments.git</repository> <repository type="git">https://github.com/nextcloud/richdocuments.git</repository>

@ -4,7 +4,8 @@ var documentsSettings = {
save : function() { save : function() {
$('#wopi_apply').attr('disabled', true); $('#wopi_apply').attr('disabled', true);
var data = { var data = {
wopi_url : $('#wopi_url').val().replace(/\/$/, '') wopi_url : $('#wopi_url').val().replace(/\/$/, ''),
wopi_internal_url : $('#wopi_internal_url').val().replace(/\/$/, '')
}; };
OC.msg.startAction('#documents-admin-msg', t('richdocuments', 'Saving…')); OC.msg.startAction('#documents-admin-msg', t('richdocuments', 'Saving…'));

@ -53,6 +53,7 @@ class SettingsController extends Controller{
public function getSettings() { public function getSettings() {
return new JSONResponse([ return new JSONResponse([
'wopi_url' => $this->appConfig->getAppValue('wopi_url'), 'wopi_url' => $this->appConfig->getAppValue('wopi_url'),
'wopi_internal_url' => $this->appConfig->getAppValue('wopi_internal_url'),
'edit_groups' => $this->appConfig->getAppValue('edit_groups'), 'edit_groups' => $this->appConfig->getAppValue('edit_groups'),
'doc_format' => $this->appConfig->getAppValue('doc_format'), 'doc_format' => $this->appConfig->getAppValue('doc_format'),
]); ]);
@ -60,13 +61,15 @@ class SettingsController extends Controller{
/** /**
* @param string $wopi_url * @param string $wopi_url
* @param string $wopi_internal_url
* @param string $edit_groups * @param string $edit_groups
* @param string $doc_format * @param string $doc_format
* @return JSONResponse * @return JSONResponse
*/ */
public function setSettings($wopi_url, public function setSettings($wopi_url,
$edit_groups, $wopi_internal_url,
$doc_format){ $edit_groups,
$doc_format) {
$message = $this->l10n->t('Saved'); $message = $this->l10n->t('Saved');
if ($wopi_url !== null){ if ($wopi_url !== null){
@ -77,6 +80,10 @@ class SettingsController extends Controller{
$message = $this->l10n->t('Saved with error: Collabora Online should use the same protocol as the server installation.'); $message = $this->l10n->t('Saved with error: Collabora Online should use the same protocol as the server installation.');
} }
} }
if ($wopi_internal_url !== null){
$this->appConfig->setAppValue('wopi_internal_url', $wopi_internal_url);
}
if ($edit_groups !== null){ if ($edit_groups !== null){
$this->appConfig->setAppValue('edit_groups', $edit_groups); $this->appConfig->setAppValue('edit_groups', $edit_groups);

@ -47,6 +47,7 @@ class Admin implements ISettings {
'admin', 'admin',
[ [
'wopi_url' => $this->config->getAppValue('richdocuments', 'wopi_url'), 'wopi_url' => $this->config->getAppValue('richdocuments', 'wopi_url'),
'wopi_internal_url' => $this->config->getAppValue('richdocuments', 'wopi_internal_url'),
'edit_groups' => $this->config->getAppValue('richdocuments', 'edit_groups'), 'edit_groups' => $this->config->getAppValue('richdocuments', 'edit_groups'),
'doc_format' => $this->config->getAppValue('richdocuments', 'doc_format'), 'doc_format' => $this->config->getAppValue('richdocuments', 'doc_format'),
], ],

@ -77,7 +77,7 @@ class DiscoveryManager {
$file = $this->appData->newFile('discovery.xml'); $file = $this->appData->newFile('discovery.xml');
}*/ }*/
$remoteHost = str_replace("hostname.host", $_SERVER["HTTP_HOST"], $this->config->getAppValue('richdocuments', 'wopi_url')); $remoteHost = $this->config->getAppValue('richdocuments', 'wopi_internal_url');
$wopiDiscovery = $remoteHost . '/hosting/discovery'; $wopiDiscovery = $remoteHost . '/hosting/discovery';
$client = $this->clientService->newClient(); $client = $this->clientService->newClient();

@ -16,7 +16,8 @@ use \OCP\IConfig;
class AppConfig{ class AppConfig{
private $appName = 'richdocuments'; private $appName = 'richdocuments';
private $defaults = [ private $defaults = [
'wopi_url' => 'https://localhost:9980' 'wopi_url' => 'https://localhost:9980',
'wopi_internal_url' => "https://localhost:9980"
]; ];
private $config; private $config;

@ -6,7 +6,9 @@ script('richdocuments', 'admin');
<label for="wopi_url"><?php p($l->t('Collabora Online server')) ?></label> <label for="wopi_url"><?php p($l->t('Collabora Online server')) ?></label>
<input type="text" name="wopi_url" id="wopi_url" value="<?php p($_['wopi_url'])?>" style="width:300px;"> <input type="text" name="wopi_url" id="wopi_url" value="<?php p($_['wopi_url'])?>" style="width:300px;">
<br/><em><?php p($l->t('URL (and port) of the Collabora Online server that provides the editing functionality as a WOPI client. If you use "hostname.host" as the host, it will be replaced with the current server name.')) ?></em> <br/><em><?php p($l->t('URL (and port) of the Collabora Online server that provides the editing functionality as a WOPI client. If you use "hostname.host" as the host, it will be replaced with the current server name.')) ?></em>
<br/><button type="button" id="wopi_apply"><?php p($l->t('Apply')) ?></button> <input type="text" name="wopi_internal_url" id="wopi_internal_url" value="<?php p($_['wopi_internal_url'])?>" style="width:300px;">
<br/><em><?php p($l->t('URL (and port) of the Collabora Online server. This entry will be used for server-side actions.')) ?></em>
<br/><button type="button" id="wopi_apply"><?php p($l->t('Apply')) ?></button>
<span id="documents-admin-msg" class="msg"></span> <span id="documents-admin-msg" class="msg"></span>
<br/> <br/>
<input type="checkbox" class="edit-groups-enable" id="edit_groups_enable-richdocuments" /> <input type="checkbox" class="edit-groups-enable" id="edit_groups_enable-richdocuments" />

Loading…
Cancel
Save