Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions browser/html/cool.html.m4
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,7 @@ m4_ifelse(MOBILEAPP,[true],
</div>
<div id="about-dialog-info-container">
<div id="about-dialog-info">
<div id="coolwsd-version-label"></div>
<div class="about-dialog-info-div"><div id="coolwsd-version" dir="ltr"></div></div>
<div class="spacer"></div>
<div id="lokit-version-label"></div>
<div class="about-dialog-info-div"><div id="lokit-version" dir="ltr"></div></div>
m4_ifelse(MOBILEAPP,[],[<div id="served-by"><span id="served-by-label"></span>&nbsp;<span id="os-info"></span>&nbsp;<wbr><span id="coolwsd-id"></span></div>],[<p></p>])
<div id="slow-proxy"></div>
m4_ifelse(DEBUG,[true],[<div id="js-dialog">JSDialogs: <a href="#">View widgets</a></div>])
<div id="routeToken"></div>
<div id="timeZone"></div>
m4_ifelse(MOBILEAPP,[],[<div id="wopi-host-id">%WOPI_HOST_ID%</div>],[<p></p>])
<p class="about-dialog-info-div"><span dir="ltr">Copyright © _YEAR_, VENDOR.</span></p>
<div id="lokit-version" dir="ltr"></div>
</div>
</div>
</div>
Expand Down Expand Up @@ -300,6 +289,9 @@ m4_ifelse(MOBILEAPP, [true],
data-geolocation-setup = "%GEOLOCATION_SETUP%"
data-canvas-slideshow-enabled = "%CANVAS_SLIDESHOW_ENABLED%"
data-wopi-setting-base-url = "%WOPI_SETTING_BASE_URL%"
data-wopi-host-id = "%WOPI_HOST_ID%"
data-vendor = VENDOR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put it inside " " as other strings I think.
Also the YEAR

data-copyright-year = _YEAR_
/>
])

Expand Down
3 changes: 3 additions & 0 deletions browser/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ class BrowserInitializer extends InitializerBase {
window.geolocationSetup = element.dataset.geolocationSetup.toLowerCase().trim() === "true";
window.canvasSlideshowEnabled = element.dataset.canvasSlideshowEnabled.toLowerCase().trim() === "true";
window.wopiSettingBaseUrl = element.dataset.wopiSettingBaseUrl;
window.wopiHostId = element.dataset.wopiHostId;
window.vendor = element.dataset.vendor;
window.copyrightYear = element.dataset.copyrightYear;
}

postMessageHandler(e) {
Expand Down
111 changes: 14 additions & 97 deletions browser/src/app/Socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1601,56 +1601,12 @@ class Socket {
}
}

const versionLabelElement = document.getElementById(
'coolwsd-version-label',
);
if (versionLabelElement) {
versionLabelElement.textContent = _('COOLWSD version:');
} else {
console.assert(false, '#coolwsd-version-label element does not exist!');
}
const h = this.WSDServer.Hash;
const versionContainer = document.getElementById('coolwsd-version');
if (!versionContainer) {
console.assert(
false,
'#coolwsd-version container element does not exist!',
);
}
if (
versionContainer &&
parseInt(h, 16).toString(16) === h.toLowerCase().replace(/^0+/, '')
) {
const anchor = document.createElement('a');
anchor.setAttribute(
'href',
'https://github.com/CollaboraOnline/online/commits/' + h,
);
anchor.setAttribute('target', '_blank');
anchor.textContent = h;

versionContainer.replaceChildren();

versionContainer.appendChild(
document.createTextNode(this.WSDServer.Version),
);

const span = document.createElement('span');
span.appendChild(document.createTextNode('git hash:\xA0'));
span.appendChild(anchor);
span.appendChild(document.createTextNode(this.WSDServer.Options));
versionContainer.appendChild(span);
} else if (versionContainer) {
versionContainer.textContent = this.WSDServer.Version;
}

if (!window.ThisIsAMobileApp) {
const idUri = window.makeHttpUrl('/hosting/discovery');
$('#served-by-label').text(_('Served by:'));
$('#coolwsd-id').html(
'<a target="_blank" href="' + idUri + '">' + this.WSDServer.Id + '</a>',
);
}
Object.assign(window.app.serverInfo, {
coolwsdVersion: this.WSDServer.Version || '',
coolwsdHash: this.WSDServer.Hash || '',
serverId: this.WSDServer.Id || '',
wsdOptions: this.WSDServer.Options || '',
});

// TODO: For now we expect perfect match in protocol versions
if (this.WSDServer.Protocol !== this.ProtocolVersionNumber) {
Expand All @@ -1662,62 +1618,23 @@ class Socket {

// 'lokitversion ' message.
private _onLokitVersionMsg(textMsg: string): void {
const versionLabelElement = document.getElementById('lokit-version-label');
const versionContainer = document.getElementById('lokit-version');

if (!versionLabelElement) {
console.assert(false, '#lokit-version-label element missing in DOM!');
return;
}
if (!versionContainer) {
console.assert(false, '#lokit-version element missing in DOM!');
return;
}

versionLabelElement.textContent = _('LOKit version:');

const lokitVersionObj = JSON.parse(textMsg.substring(textMsg.indexOf('{')));

versionContainer.replaceChildren();
versionContainer.appendChild(
document.createTextNode(
lokitVersionObj.ProductName +
'\xA0' +
lokitVersionObj.ProductVersion +
lokitVersionObj.ProductExtension,
),
);

const h = lokitVersionObj.BuildId.substring(0, 10);
if (parseInt(h, 16).toString(16) === h.toLowerCase().replace(/^0+/, '')) {
const anchor = document.createElement('a');
anchor.setAttribute('target', '_blank');
anchor.setAttribute(
'href',
'https://git.libreoffice.org/core/+log/' +
lokitVersionObj.BuildId +
'/',
);
anchor.textContent = 'git hash: ' + h;

const span = document.createElement('span');
span.appendChild(anchor);
versionContainer.appendChild(span);
} else {
const span = document.createElement('span');
span.textContent = 'git hash:\xA0' + h;
versionContainer.appendChild(span);
}

this.TunnelledDialogImageCacheSize =
lokitVersionObj.tunnelled_dialog_image_cache_size;

Object.assign(window.app.serverInfo, {
lokitVersionName: lokitVersionObj.ProductName,
lokitVersionNumber: lokitVersionObj.ProductVersion,
lokitVersionSuffix: lokitVersionObj.ProductExtension,
lokitHash: lokitVersionObj.BuildId,
});
}

// 'osinfo ' message.
private _onOsInfoMsg(textMsg: string) {
const osInfo = textMsg.replace('osinfo ', '');
const osInfoElement = document.getElementById('os-info');
if (osInfoElement) osInfoElement.innerText = osInfo;
window.app.serverInfo.osInfo = osInfo;
}

// 'clipboardkey:' message.
Expand Down
Loading
Loading