add cookie domain to pyx.properties so all servers can share the same cookie
This commit is contained in:
parent
7be74010a6
commit
ef4c172fca
|
@ -1,2 +1,3 @@
|
|||
pyx.cookie_domain=*.socialgamer.net
|
||||
pyx.server.max_users=800
|
||||
pyx.server.max_games=200
|
||||
|
|
|
@ -95,6 +95,7 @@ function nickbox_keyup(e) {
|
|||
function nicknameconfirm_click() {
|
||||
var nickname = $.trim($("#nickname").val());
|
||||
$.cookie("nickname", nickname, {
|
||||
domain : cah.COOKIE_DOMAIN,
|
||||
expires : 365
|
||||
});
|
||||
cah.Ajax.build(cah.$.AjaxOperation.REGISTER).withNickname(nickname).run();
|
||||
|
@ -249,6 +250,7 @@ function load_preferences() {
|
|||
function save_preferences() {
|
||||
if ($("#hide_connect_quit").attr("checked")) {
|
||||
$.cookie("hide_connect_quit", true, {
|
||||
domain : cah.COOKIE_DOMAIN,
|
||||
expires : 365
|
||||
});
|
||||
} else {
|
||||
|
@ -256,6 +258,7 @@ function save_preferences() {
|
|||
}
|
||||
|
||||
$.cookie("ignore_list", $("#ignore_list").val(), {
|
||||
domain : cah.COOKIE_DOMAIN,
|
||||
expires : 365
|
||||
});
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.socialgamer.cah.servlets;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
|
@ -10,6 +11,10 @@ import javax.servlet.http.HttpServlet;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.socialgamer.cah.StartupUtils;
|
||||
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
||||
@WebServlet("/js/cah.config.js")
|
||||
public class JavascriptConfigServlet extends HttpServlet {
|
||||
|
@ -41,9 +46,16 @@ public class JavascriptConfigServlet extends HttpServlet {
|
|||
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
|
||||
// We have to do this every time since it comes from the properties file and that can change...
|
||||
final StringBuilder builder = new StringBuilder(256);
|
||||
final Injector injector = (Injector) getServletContext().getAttribute(StartupUtils.INJECTOR);
|
||||
final String cookieDomain = (String) injector.getInstance(Properties.class).get(
|
||||
"pyx.cookie_domain");
|
||||
builder.append(String.format("cah.COOKIE_DOMAIN = '%s';\n", cookieDomain));
|
||||
|
||||
resp.setContentType("text/javascript");
|
||||
final PrintWriter out = resp.getWriter();
|
||||
out.println(configString);
|
||||
out.println(configString + builder.toString());
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue