Skip to content
Snippets Groups Projects
Commit 6b2f362e authored by git's avatar git
Browse files

fix server deployments

parent 991f92a1
Branches
No related tags found
No related merge requests found
Pipeline #162800 passed
......@@ -58,11 +58,13 @@ services:
#VIRTUAL_HOST: 103.112.212.22
# SHARELATEX_SITE_URL: http://sharelatex.mydomain.com
# SHARELATEX_NAV_TITLE: Our ShareLaTeX Instance
SHARELATEX_NAV_TITLE: Overleaf Ruhr
# SHARELATEX_HEADER_IMAGE_URL: http://somewhere.com/mylogo.png
# SHARELATEX_ADMIN_EMAIL: support@it.com
SHARELATEX_ADMIN_EMAIL: ${SHARELATEX_ADMIN_EMAIL}
SHARELATEX_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING: 'true'
SHARELATEX_ALLOW_PUBLIC_ACCESS: 'true'
# SHARELATEX_LEFT_FOOTER: '[{"text": "Powered by <a href=\"https://www.sharelatex.com\">ShareLaTeX</a> 2016"},{"text": "Another page I want to link to can be found <a href=\"here\">here</a>"} ]'
SHARELATEX_LEFT_FOOTER: '[{"text": "Powered by Overleaf and Faculties Computer Science Ruhr 2023"}]'
# SHARELATEX_RIGHT_FOOTER: '[{"text": "Hello I am on the Right"} ]'
# SHARELATEX_EMAIL_FROM_ADDRESS: "team@sharelatex.com"
......
......@@ -95,33 +95,47 @@ const endRemoteGitRequest =
| ~returns: true if user is authenticated and logged into overleaf
*/
const handleAuth =
async function( req, res, client, project_id )
{
let auth = req.headers.authorization;
if( !auth )
async function( req, res, client, project_id, access_token )
{
try {
await client.get( olServer + '/' + access_token );
//await olops.login( client, olServer );
} catch( e ) {
console.log( client.count, 'requesting authorization' );
res.writeHead( 401, { 'WWW-Authenticate': 'Basic realm="olgitbridge"' } );
res.end( 'Authorization is needed' );
return false;
}
auth = auth.replace(/^Basic /, '');
auth = Buffer.from( auth, 'base64' ).toString( 'utf8' );
auth = auth.split( ':' );
const email = auth[ 0 ];
const password = auth[ 1 ];
console.log( client.count, 'requesting user semaphore' );
const uflag = await users.get( email );
console.log( client.count, 'auth email', email );
console.log( client.count, 'overleaf login' );
// let auth = req.headers.authorization;
// if( !auth )
// {
// console.log( client.count, 'requesting authorization' );
// res.writeHead( 401, { 'WWW-Authenticate': 'Basic realm="olgitbridge"' } );
// res.end( 'Authorization is needed' );
// return false;
// }
// auth = auth.replace(/^Basic /, '');
// auth = Buffer.from( auth, 'base64' ).toString( 'utf8' );
// auth = auth.split( ':' );
// const email = auth[ 0 ];
// const password = auth[ 1 ];
// console.log( client.count, 'requesting user semaphore' );
// const uflag = await users.get( email );
// console.log( client.count, 'auth email', email );
// console.log( client.count, 'overleaf login' );
try
{
await olops.login( client, olServer, email, password );
// await olops.login( client, olServer, email, password );
await olops.getProjectPage( client, olServer, project_id );
}
catch( e )
{
res.writeHead( 401, 'Unauthorized' );
res.end( );
return;
users.release( email, uflag );
if( e.response.status === 401 )
{
......@@ -132,7 +146,7 @@ const handleAuth =
// rethrows other errors
throw e;
}
return Object.freeze({ email: email, uflag: uflag });
return {}//Object.freeze({ email: email, uflag: uflag });
};
/*
......@@ -209,20 +223,27 @@ const serve =
{
const count = '[' + (++counter) + ']';
const url = req.url;
let project_id = url.split( '/' )[ 1 ];
// cuts away the .git if given
if( project_id.endsWith( '.git' ) )
{
project_id = project_id.substr( 0, project_id.length - 4 );
let project_id = "";
let access_token = "";
try {
project_id = url.split("/git/")[1].split("/")[0];
access_token = url.split("/git/")[1].split("/")[1].split(".git")[0]
}
catch (e) {
console.log( count, 'invalid request' );
res.writeHead( 400, 'Bad Request' );
res.end( );
return;
}
console.log( count, 'getting request for', project_id );
const client = olops.client( );
client.count = count;
try {
const auth = await handleAuth( req, res, client, project_id );
const auth = await handleAuth( req, res, client, project_id , access_token);
if( !auth ) return;
const pflag = await prepareProject( count, project_id );
......
......@@ -64,6 +64,16 @@
i.fa.fa-download
| &nbsp;#{translate("download_project_at_this_version")}
a.history-toolbar-btn-danger.pull-right(
ng-hide="history.loadingFileTree || history.selection.range.toV == null"
ng-href="/project/{{ project_id }}/version/{{ history.selection.range.toV }}/zip"
target="_blank"
)
a.history-toolbar-btn-danger.pull-right(
onClick="alert('Add this as mirror in GitHub, etc.: '+ document.URL.replace('project','git')+'.git')"
)
i.fa.fa-git
//- compare mode actions
......
......@@ -64,7 +64,7 @@ aside#left-menu.full-size(
li()
a(
onClick="alert('Git Sync '+ document.URL.replace('project','git')+'.git')"
onClick="alert('Add this as mirror in GitHub, etc.: '+ document.URL.replace('project','git')+'.git')"
)
i.fa.fa-fw.fa-git
span &nbsp;&nbsp; Git Sync
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment