2016-09-30 04:50:06 -05:00
exports . diskfull = _ ( 'No disk space left on server, please contact the server administrator to continue.' ) ;
2016-10-17 08:23:22 -05:00
exports . emptyhosturl = _ ( 'The host URL is empty. The loolwsd server is probably misconfigured, please contact the administrator.' ) ;
2016-10-24 15:18:00 -05:00
exports . limitreached = _ ( 'This development build is limited to %0 documents, and %1 connections - to avoid the impression that it is suitable for deployment in large enterprises. To find out more about deploying and scaling %2 check out: <br/><a href=\"%3\">%3</a>.' ) ;
2017-01-28 17:36:17 -06:00
exports . limitreachedprod = _ ( 'This service is limited to %0 documents, and %1 connections total by the admin. This limit has been reached. Please try again later.' ) ;
2016-10-12 10:52:29 -05:00
exports . serviceunavailable = _ ( 'Service is unavailable. Please try again later and report to your administrator if the issue persists.' ) ;
Attempt to handle unauthorized WOPI usage better
Use the previously unused UnauthorizedRequestException for this, and
throw a such in StorageBase::create() when the WOPI host doesn't match
any of those configured.
In a developer debug build, without access to any real WOPI
functionality, you can test by setting the FAKE_UNAUTHORIZED
environment variable and attempting to edit a plain local file:
URI. That will cause such an exception to be thrown in that function.
Catch that UnauthorizedRequestException in
ClientRequestHandler::handleGetRequest(), and send an 'error:
cmd=internal kind=unauthorized' message to the client. Handle that in
loleaflet in the same place where the 'error: cmd=internal
kild=diskfull' message is handled, and in the same fashion, giving up
on the document.
Actually, using exceptions for relatively non-exceptional situations
like this is lame and makes understanding the code harder, but that is
just my personal preference...
FIXME: By the time StorageBase::create() gets called we have already
sent three 'statusindicator:' messages ('find', 'connect', and
'ready') to the client. We should ideally do the checks we do in
StorageBase::create() much earlier.
Also consider that ClientRequestHandler::handleClientRequest() has
code that catches UnauthorizedRequestException and
BadRequestException, and tries to set the HTTP response in those
cases. I am not sure if that functionality has ever been exercised,
though. Currently, we upgrade the HTTP connection to WebSocket early,
and only after that we check whether the WOPI host is authorized
etc. By that time it is too late to return an HTTP response to the
user. If that even is what we ideally should do? If not, then we
probably should drop the code that constructs HTTP responses and
attempts to send them.
Also, if I, as a test, force an HTTPResponse::HTTP_BAD_REQUEST to be
sent before the HTTP connection is upgraded to WebSocket, loleaflet
throws up the generic "Well, this is embarrassing" dialog anyway. At
least in Firefox on Linux. (Instead of the browser showing some own
dialog, which I was half-expecting to happen.)
2016-10-17 08:55:20 -05:00
exports . unauthorized = _ ( 'Unauthorized WOPI host. Please try again later and report to your administrator if the issue persists.' ) ;
2016-10-17 08:23:22 -05:00
exports . wrongwopisrc = _ ( 'Wrong WOPISrc, usage: WOPISrc=valid encoded URI, or file_path, usage: file_path=/path/to/doc/' ) ;
2016-11-29 09:47:18 -06:00
exports . sessionexpiry = _ ( 'Your session will expire in %time. Please save your work and refresh the session (or webpage) to continue.' ) ;
exports . sessionexpired = _ ( 'Your session has been expired. Further changes to document might not be saved. Please refresh the session (or webpage) to continue.' ) ;
2017-01-15 21:50:08 -06:00
exports . faileddocloading = _ ( 'Failed to load the document. Please ensure the file type is supported and not corrupted, and try again.' ) ;
2016-11-23 06:09:54 -06:00
exports . storage = {
2017-05-18 13:05:45 -05:00
loadfailed : _ ( 'Failed to read document from storage. Please contact your storage server (%storageserver) administrator.' ) ,
savediskfull : _ ( 'Save failed due to no disk space left on storage server. Document will now be read-only. Please contact the server (%storageserver) administrator to continue editing.' ) ,
2017-06-06 09:53:34 -05:00
saveunauthorized : _ ( 'Document cannot be saved due to expired or invalid access token.' ) ,
2017-06-06 22:49:52 -05:00
savefailed : _ ( 'Document cannot be saved. Check your permissions or contact the storage server administrator.' )
2016-11-23 06:09:54 -06:00
} ;