mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Corrected remoteAddr to localName.
This commit is contained in:
parent
db2bf43aa7
commit
06a7ee6614
7 changed files with 13 additions and 13 deletions
|
@ -25,7 +25,7 @@ public class SnapshotPushPostbackHandler extends AbstractHandler {
|
|||
}
|
||||
|
||||
System.out.println(request.getRemoteAddr());
|
||||
System.out.println(request.getLocalAddr());
|
||||
System.out.println(request.getLocalName());
|
||||
System.out.println("method: " + request.getMethod());
|
||||
System.out.println("pathInfo: " + request.getPathInfo());
|
||||
System.out.println("contextPath: " + request.getContextPath());
|
||||
|
|
|
@ -15,7 +15,7 @@ public interface WriteLatexDataSource {
|
|||
/* Called by request thread. */
|
||||
public boolean repositoryExists(String projectName) throws FailedConnectionException;
|
||||
public List<WritableRepositoryContents> getWritableRepositories(String projectName) throws FailedConnectionException, InvalidProjectException;
|
||||
public void putDirectoryContentsToProjectWithName(String projectName, RawDirectoryContents directoryContents, String remoteAddr) throws SnapshotPostException, IOException, FailedConnectionException;
|
||||
public void putDirectoryContentsToProjectWithName(String projectName, RawDirectoryContents directoryContents, String hostname) throws SnapshotPostException, IOException, FailedConnectionException;
|
||||
public void expectPostback(String projectName);
|
||||
|
||||
/* Called by postback thread. */
|
||||
|
|
|
@ -25,7 +25,7 @@ public class WLReceivePackFactory implements ReceivePackFactory<HttpServletReque
|
|||
@Override
|
||||
public ReceivePack create(HttpServletRequest httpServletRequest, Repository repository) throws ServiceNotEnabledException, ServiceNotAuthorizedException {
|
||||
ReceivePack receivePack = new ReceivePack(repository);
|
||||
receivePack.setPreReceiveHook(new WriteLatexPutHook(writeLatexDataSource, httpServletRequest.getRemoteAddr()));
|
||||
receivePack.setPreReceiveHook(new WriteLatexPutHook(writeLatexDataSource, httpServletRequest.getLocalName()));
|
||||
return receivePack;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ import java.util.Collection;
|
|||
public class WriteLatexPutHook implements PreReceiveHook {
|
||||
|
||||
private final WriteLatexDataSource writeLatexDataSource;
|
||||
private final String remoteAddr;
|
||||
private final String hostname;
|
||||
|
||||
public WriteLatexPutHook(WriteLatexDataSource writeLatexDataSource, String remoteAddr) {
|
||||
public WriteLatexPutHook(WriteLatexDataSource writeLatexDataSource, String hostname) {
|
||||
this.writeLatexDataSource = writeLatexDataSource;
|
||||
this.remoteAddr = remoteAddr;
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,7 +58,7 @@ public class WriteLatexPutHook implements PreReceiveHook {
|
|||
writeLatexDataSource.putDirectoryContentsToProjectWithName(repository.getWorkTree().getName(),
|
||||
getPushedDirectoryContents(repository,
|
||||
receiveCommand),
|
||||
remoteAddr);
|
||||
hostname);
|
||||
}
|
||||
|
||||
private void checkForcedPush(ReceiveCommand receiveCommand) throws ForcedPushException {
|
||||
|
|
|
@ -20,10 +20,10 @@ public class WLDirectoryNodeSnapshot implements CandidateSnapshot {
|
|||
private final WLDirectoryNode directoryNode;
|
||||
private final CandidateSnapshotCallback callback;
|
||||
|
||||
public WLDirectoryNodeSnapshot(WLProject project, WLDirectoryNode directoryNode, String remoteAddr, CandidateSnapshotCallback callback) {
|
||||
public WLDirectoryNodeSnapshot(WLProject project, WLDirectoryNode directoryNode, String hostname, CandidateSnapshotCallback callback) {
|
||||
previousVersionID = project.getLatestSnapshot().getVersionID();
|
||||
projectName = project.getName();
|
||||
projectURL = "http://" + remoteAddr + "/" + projectName;
|
||||
projectURL = "http://" + hostname + "/" + projectName;
|
||||
this.directoryNode = directoryNode;
|
||||
this.callback = callback;
|
||||
System.out.println(getJsonRepresentation());
|
||||
|
|
|
@ -43,8 +43,8 @@ public class WriteLatexAPI implements WriteLatexDataSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void putDirectoryContentsToProjectWithName(String projectName, RawDirectoryContents directoryContents, String remoteAddr) throws SnapshotPostException, IOException, FailedConnectionException {
|
||||
CandidateSnapshot candidate = dataModel.createCandidateSnapshotFromProjectWithContents(projectName, directoryContents, remoteAddr);
|
||||
public void putDirectoryContentsToProjectWithName(String projectName, RawDirectoryContents directoryContents, String hostname) throws SnapshotPostException, IOException, FailedConnectionException {
|
||||
CandidateSnapshot candidate = dataModel.createCandidateSnapshotFromProjectWithContents(projectName, directoryContents, hostname);
|
||||
new SnapshotPushRequest(candidate).request();
|
||||
throw new SnapshotPostException() {
|
||||
|
||||
|
|
|
@ -43,11 +43,11 @@ public class WLDataModel implements CandidateSnapshotCallback {
|
|||
return project;
|
||||
}
|
||||
|
||||
public CandidateSnapshot createCandidateSnapshotFromProjectWithContents(String projectName, RawDirectoryContents directoryContents, String remoteAddr) throws SnapshotPostException, IOException, FailedConnectionException {
|
||||
public CandidateSnapshot createCandidateSnapshotFromProjectWithContents(String projectName, RawDirectoryContents directoryContents, String hostname) throws SnapshotPostException, IOException, FailedConnectionException {
|
||||
return new WLDirectoryNodeSnapshot(getProjectWithName(projectName),
|
||||
fileStore.createNextDirectoryNodeInProjectFromContents(getProjectWithName(projectName),
|
||||
directoryContents),
|
||||
remoteAddr,
|
||||
hostname,
|
||||
this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue