Commit cca7ed53 authored by Grzegorz Pietrusza's avatar Grzegorz Pietrusza

fix redirect

parent 6cea2a25
...@@ -37,8 +37,7 @@ module.exports = function (grunt) { ...@@ -37,8 +37,7 @@ module.exports = function (grunt) {
'./service/src/main/resources/assets_build/scoresheet.html': './service/src/main/resources/assets/scoresheet.html', './service/src/main/resources/assets_build/scoresheet.html': './service/src/main/resources/assets/scoresheet.html',
'./service/src/main/resources/assets_build/submitflag.html': './service/src/main/resources/assets/submitflag.html', './service/src/main/resources/assets_build/submitflag.html': './service/src/main/resources/assets/submitflag.html',
'./service/src/main/resources/assets_build/task.html': './service/src/main/resources/assets/task.html', './service/src/main/resources/assets_build/task.html': './service/src/main/resources/assets/task.html',
'./service/src/main/resources/assets_build/tasks.html': './service/src/main/resources/assets/tasks.html', './service/src/main/resources/assets_build/tasks.html': './service/src/main/resources/assets/tasks.html'
'./service/src/main/resources/assets_build/redirect.html': './service/src/main/resources/assets/redirect.html'
} }
} }
}, },
......
...@@ -6,7 +6,6 @@ import com.telephoners.krakyournet.ctf.beans.User; ...@@ -6,7 +6,6 @@ import com.telephoners.krakyournet.ctf.beans.User;
import com.telephoners.krakyournet.ctf.core.ApplicationConfiguration; import com.telephoners.krakyournet.ctf.core.ApplicationConfiguration;
import com.telephoners.krakyournet.ctf.repositories.TeamsRepository; import com.telephoners.krakyournet.ctf.repositories.TeamsRepository;
import io.dropwizard.auth.Auth; import io.dropwizard.auth.Auth;
import org.apache.commons.io.FileUtils;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
...@@ -16,7 +15,6 @@ import javax.ws.rs.Produces; ...@@ -16,7 +15,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.io.File;
import java.io.IOException; import java.io.IOException;
@Singleton @Singleton
...@@ -24,6 +22,7 @@ import java.io.IOException; ...@@ -24,6 +22,7 @@ import java.io.IOException;
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public class UtilResource public class UtilResource
{ {
private static String redirectHtml = "<!DOCTYPE html><html lang=\"en\" ng-app=\"ctfApp\"><head></head><script type=\"text/javascript\">window.location = \"http://\" + window.location.host;</script></html>";
private final TeamsRepository teamsRepository; private final TeamsRepository teamsRepository;
private final ApplicationConfiguration applicationConfiguration; private final ApplicationConfiguration applicationConfiguration;
...@@ -65,7 +64,6 @@ public class UtilResource ...@@ -65,7 +64,6 @@ public class UtilResource
@Path("/auth") @Path("/auth")
public Response auth(@Auth User user) throws IOException public Response auth(@Auth User user) throws IOException
{ {
String redirectHtml = new String(FileUtils.readFileToByteArray(new File("service/src/main/resources/assets/redirect.html")));
return Response.ok() return Response.ok()
.entity(redirectHtml) .entity(redirectHtml)
.header(HttpHeaders.CONTENT_TYPE, "text/html") .header(HttpHeaders.CONTENT_TYPE, "text/html")
......
<!DOCTYPE html>
<html lang="en" ng-app="ctfApp">
<head>
</head>
<script type="text/javascript">
window.location = "http://" + window.location.host;
</script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment