Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Upstream #4

Open
wants to merge 115 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
1e23f40
Update and rename README to README.md
Apr 13, 2016
9a776fb
Fix typo of "hard" to "hand"
rootatdebian Sep 10, 2016
eb66ccd
Remove the CORS filter.
ajanata Feb 15, 2017
a390743
add git commit id to pyx.properties
ajanata Feb 15, 2017
d206ed8
another warning turned on in eclipse
ajanata Feb 15, 2017
141876f
Merge pull request #150 from rootatdebian/master
ajanata Feb 15, 2017
a9d3fef
Merge pull request #148 from SSederberg/patch-1
ajanata Feb 15, 2017
15aced1
add instructions on how to avoid buildnumber plugin errors to readme
ajanata Feb 15, 2017
d919c07
escape card text from cardcast. fixes xss issues.
ajanata Feb 15, 2017
f3f9dbe
escape the set name and description too
ajanata Feb 15, 2017
32aac1b
update admin ip addresses, make chat spam filter more aggressive
ajanata Feb 21, 2017
b5fef60
use constant value in error message
ajanata Feb 21, 2017
72b4cd9
Add persistent IDs to users, stored via cookie (opt-out availabled).
ajanata Feb 21, 2017
e1bc2c4
document unused build.properties value
ajanata Feb 21, 2017
45690c1
Add user client information to user metrics info (language, device cl…
ajanata Feb 24, 2017
a0d21cd
make metrics methods agree in tense
ajanata Feb 24, 2017
1e09b55
java 8
ajanata Feb 27, 2017
a67c721
fix some warnings
ajanata Feb 27, 2017
a38dc53
fix some hibernate deprecation warnings
ajanata Feb 27, 2017
23ce041
implement kafka metrics without tls or authentication
ajanata Feb 27, 2017
5f18168
configure logging before injector creation so injected constructors c…
ajanata Feb 27, 2017
5e6791e
kafka tls
ajanata Mar 4, 2017
73c41cc
fix some cleanup issues when unable to connect to kafka
ajanata Mar 4, 2017
942903e
sasl support for kafka
ajanata Mar 4, 2017
b2c27cd
add privacy page
ajanata Mar 5, 2017
9679d0f
add watermark to card information sent to metrics
ajanata Apr 15, 2017
17ac407
Disable global chat except for admins. Add release notes.
ajanata Aug 13, 2017
5e60e10
Handle null HTTP headers for language and user agent
ajanata Aug 13, 2017
88f58fb
Update README with correct command to run via jetty. Fixes #163.
ajanata Feb 15, 2018
91db059
Use C3P0 for Hibernate connection pooling. This fixes the issue where…
ajanata Feb 16, 2018
89a4cee
* Change card set sort order from 'weight, id' to 'weight, name'.
ajanata Feb 22, 2018
adab3b7
Add card dealt metrics.
ajanata Feb 26, 2018
b80f12e
Update cards with official CAH cards through Q3 2017 from data provid…
ajanata Feb 26, 2018
a94ba4a
Fix default value for idle time multiplier in GameOptions so the drop…
ajanata Feb 26, 2018
d143791
* Fix some cases of not all decks being listed because the javascript…
ajanata Feb 27, 2018
ce7e9da
Revised new card database dump. Addresses cards with the same text bu…
ajanata Feb 27, 2018
216ff63
Sort full games to the end of the game list. Fixes #157.
ajanata Feb 28, 2018
4b75185
* Add stylesheet to privacy and changelog pages.
ajanata Feb 28, 2018
e2960ee
make lastpass also ignore the chat entry area
ajanata Feb 28, 2018
cb0f268
Let global chat enablement be configured via the properties file. Can…
ajanata Feb 28, 2018
cdd3846
HTML cleanup.
ajanata Mar 2, 2018
dc31b1f
Fix not focusing the nickname box on page load.
ajanata Mar 2, 2018
7a24c65
Add ID codes for positive user identification, and minor fixups.
ajanata Mar 3, 2018
feed54d
Fix an oddly-formatted black card's pick value.
ajanata Mar 4, 2018
1fb621e
Fix "Make a haiku." draw and pick values.
ajanata Mar 5, 2018
e157853
Add a /whois command.
ajanata Mar 6, 2018
f7378e0
Show the /whois result in the window it was typed in.
ajanata Mar 6, 2018
24881d1
Allow white cards with images, and minor cleanup.
ajanata Mar 7, 2018
204c6be
Fix stop spectating a game when user disconnects.
ajanata Mar 7, 2018
b20562d
Add a crude scrollbar to user preferences and game list filters.
ajanata Mar 9, 2018
b5c9bff
port UpdateJsConstants to make Go constants
ajanata Mar 12, 2018
6a61727
just type everything as strings for go
ajanata Mar 13, 2018
72fd7f8
More extensive Go code generation for constants.
ajanata Mar 13, 2018
89e164e
Fixes for Go code generation.
ajanata Mar 13, 2018
f7386c8
Uncomment and fix annotation spelling
ajanata Mar 16, 2018
7375dd8
Minor fixes for Go API client.
ajanata Mar 16, 2018
270b590
Always return serial as a number, never a string. Errors were returni…
ajanata Mar 20, 2018
ac48ea0
Delete some old stuff that was never fully implemented or needed.
ajanata Mar 22, 2018
4e2b5e4
Move admin IP addresses to config file.
ajanata Mar 22, 2018
c6f62c1
Add a ChatFilter class and use it.
ajanata Mar 23, 2018
88bfa34
Global and game chats have distinct flood controls.
ajanata Mar 23, 2018
0cf261f
Fix an NPE when logging out while in a game.
ajanata Mar 23, 2018
4bddace
Add more chat control.
ajanata Mar 24, 2018
4f9edbb
Bump the version since I'm adding so much stuff.
ajanata Mar 24, 2018
65f74ef
Add more chat filtering.
ajanata Mar 24, 2018
783b223
Updates for shadowban.
ajanata Mar 24, 2018
6e6bf61
Add logging to (FirstLoad|Register)Handler.
ajanata Mar 26, 2018
ace019d
Clarify that shadowbanned strings should be provided in lower-case.
ajanata Mar 26, 2018
fa996ab
Update change log.
ajanata Mar 26, 2018
0678272
Fix IPv6 loopback address for admin, and comment.
ajanata Mar 26, 2018
988f638
Include some creation times in responses.
ajanata Mar 26, 2018
28e040a
Send sigil/id code/persistent id when reconnecting.
ajanata Mar 27, 2018
8211726
Refer to verification code in the ui for the mangled version
ajanata Mar 27, 2018
4afab98
Include ? as a basic character, and count spaces as them too.
ajanata Mar 27, 2018
612bd09
Always send admins connect and quit events
ajanata Mar 28, 2018
a505598
Tell admins about filtered chat content.
ajanata Mar 28, 2018
dcb9553
Fix /whois not showing spectators as spectating
ajanata Mar 29, 2018
3cb0e55
GameId needs to be an *int in AjaxResponse for Go, just like LongPoll…
ajanata Mar 29, 2018
21e8f7a
AjaxResponse PLAYER_INFO is also an array, oops.
ajanata Mar 30, 2018
6d289ef
Fix a typo in a variable name
ajanata Mar 30, 2018
43f9b70
Fix Go data type for WHITE_CARDS and WINNING_CARD cuz I just guessed …
ajanata Mar 30, 2018
9bbdd38
Create LICENSE
ajanata Mar 31, 2018
1c07624
Add repeated words filtering to chat filter.
ajanata Apr 2, 2018
88ab1ac
Merge branch 'master' of github.com:ajanata/PretendYoureXyzzy
ajanata Apr 2, 2018
99958c0
Display round permalinks after the round is over, if enabled.
ajanata Apr 4, 2018
f88ed59
Update changelog
ajanata Apr 5, 2018
c71e01b
Send global chat enabled with FirstLoad
devgianlu May 13, 2018
2906ffa
Merge pull request #169 from devgianlu/master
ajanata May 18, 2018
1e3351a
Show more permalinks to users.
ajanata May 30, 2018
67c0e0e
changelog updates
ajanata Jun 1, 2018
d874025
Bugfixes and nick filter.
ajanata Jun 13, 2018
9e8aa1e
Check user address against X-Forwarded-For
ajanata Jun 13, 2018
5d05f2e
Fix for #174 (#176)
devgianlu Jul 1, 2018
c40c2d1
Add option to disable fill-in-the-blank cards entirely.
ajanata Jul 28, 2018
5759766
Add option to disable game chat.
ajanata Jul 28, 2018
332da9b
Allow admins to join any game
tyzoid Aug 1, 2018
4cd2af9
Merge pull request #182 from tyzoid/master
ajanata Aug 2, 2018
54b3087
Add more info to stats.jsp to allow server lists to disambiguate feat…
tyzoid Aug 6, 2018
c27fcc8
Merge pull request #185 from tyzoid/master
ajanata Aug 7, 2018
ec62772
Adding Docker docs to README
emcniece Aug 26, 2018
f1639dc
Allow admins to spectate any password protected game
Rubueno Aug 30, 2018
5215d8c
Merge pull request #188 from Rubueno/master
ajanata Aug 30, 2018
a384a02
Merge pull request #187 from emcniece/docker
ajanata Aug 30, 2018
8f82a01
update changelog and privacy text
ajanata Sep 4, 2018
8e1c5e8
Disable inactive card sets by default.
ajanata Oct 24, 2018
631fe14
Moved min/default/max player limit, spectator limit, score limit and …
devgianlu Sep 29, 2019
21949bc
Added min/default/max values to js config
devgianlu Sep 29, 2019
99f9c46
changed geoip version to 2.8.1 to make build work
Mar 29, 2020
296a692
big link to server list page
ajanata Apr 4, 2020
47cff64
Merge pull request #228 from Tysseract/master
ajanata May 24, 2020
4379c14
Merge pull request #219 from devgianlu/min-default-max-config
ajanata May 24, 2020
f863c13
update postgresql JDBC driver to latest version
Stary2001 May 24, 2020
15757a6
Merge pull request #246 from Stary2001/master
ajanata May 24, 2020
7021691
Fix JS error because of prefix
devgianlu May 26, 2020
ed08e37
Merge pull request #247 from devgianlu/min-default-max-config
ajanata May 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build
build.properties
target
ssl/
src/main/java/net/socialgamer/cah/util/RealShadowBannedStringProvider.java
7 changes: 4 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
Expand Down
2 changes: 1 addition & 1 deletion .settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<fixed facet="java"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
<installed facet="java" version="1.8"/>
</faceted-project>
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BSD 2-Clause License

Copyright (c) 2012-2020, Andy Janata
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 changes: 0 additions & 3 deletions README

This file was deleted.

21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Pretend You're Xyzzy
===================

A Cards Against Humanity clone, server and web client. See WebContent/license.html for full details.

Note: This project is only known to work with Tomcat 7, all other versions are unsupported.
Currently, the only way to build PYX is using Maven via ```mvn clean package war:war``` in the project's directory.


If you're doing ```mvn clean package war:exploded jetty:run```, you now need to add ```-Dmaven.buildNumber.doCheck=false -Dmaven.buildNumber.doUpdate=false``` to make the buildnumber plugin allow you to run with uncommited changes.


For GeoIP functions to work, download http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz somewhere, gunzip it, and update the geoip.db value in build.properties to point to it.

## Third-Party Usage

A Docker package for this project exists at [emcniece/DockerYourXyzzy](https://github.com/emcniece/DockerYourXyzzy):

```sh
docker run -d -p 8080:8080 emcniece/dockeryourxyzzy:dev
```
16 changes: 12 additions & 4 deletions WebContent/addcard.jsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<%--
Copyright (c) 2012, Andy Janata
Copyright (c) 2012-2018, Andy Janata
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
Expand All @@ -27,16 +27,24 @@ Administration tools.
@author Andy Janata ([email protected])
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.google.inject.Injector" %>
<%@ page import="com.google.inject.Key" %>
<%@ page import="com.google.inject.TypeLiteral" %>
<%@ page import="net.socialgamer.cah.CahModule.Admins" %>
<%@ page import="net.socialgamer.cah.HibernateUtil" %>
<%@ page import="net.socialgamer.cah.StartupUtils" %>
<%@ page import="net.socialgamer.cah.db.PyxBlackCard" %>
<%@ page import="net.socialgamer.cah.db.PyxWhiteCard" %>
<%@ page import="net.socialgamer.cah.Constants" %>
<%@ page import="net.socialgamer.cah.RequestWrapper" %>
<%@ page import="org.hibernate.Session" %>
<%@ page import="org.hibernate.Transaction" %>
<%@ page import="java.util.Set" %>
<%
RequestWrapper wrapper = new RequestWrapper(request);
if (!Constants.ADMIN_IP_ADDRESSES.contains(wrapper.getRemoteAddr())) {
RequestWrapper wrapper = new RequestWrapper(request);
ServletContext servletContext = pageContext.getServletContext();
Injector injector = (Injector) servletContext.getAttribute(StartupUtils.INJECTOR);
Set<String> admins = injector.getInstance(Key.get(new TypeLiteral<Set<String>>(){}, Admins.class));
if (!admins.contains(wrapper.getRemoteAddr())) {
response.sendError(403, "Access is restricted to known hosts");
return;
}
Expand Down
16 changes: 8 additions & 8 deletions WebContent/admin.jsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<%--
Copyright (c) 2012, Andy Janata
Copyright (c) 2012-2018, Andy Janata
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
Expand Down Expand Up @@ -32,8 +32,8 @@ Administration tools.
<%@ page import="com.google.inject.TypeLiteral" %>
<%@ page import="net.socialgamer.cah.RequestWrapper" %>
<%@ page import="net.socialgamer.cah.StartupUtils" %>
<%@ page import="net.socialgamer.cah.CahModule.Admins" %>
<%@ page import="net.socialgamer.cah.CahModule.BanList" %>
<%@ page import="net.socialgamer.cah.Constants" %>
<%@ page import="net.socialgamer.cah.Constants.DisconnectReason" %>
<%@ page import="net.socialgamer.cah.Constants.LongPollEvent" %>
<%@ page import="net.socialgamer.cah.Constants.LongPollResponse" %>
Expand All @@ -50,14 +50,14 @@ Administration tools.

<%
RequestWrapper wrapper = new RequestWrapper(request);
if (!Constants.ADMIN_IP_ADDRESSES.contains(wrapper.getRemoteAddr())) {
ServletContext servletContext = pageContext.getServletContext();
Injector injector = (Injector) servletContext.getAttribute(StartupUtils.INJECTOR);
Set<String> admins = injector.getInstance(Key.get(new TypeLiteral<Set<String>>(){}, Admins.class));
if (!admins.contains(wrapper.getRemoteAddr())) {
response.sendError(403, "Access is restricted to known hosts");
return;
}

ServletContext servletContext = pageContext.getServletContext();
Injector injector = (Injector) servletContext.getAttribute(StartupUtils.INJECTOR);

ConnectedUsers connectedUsers = injector.getInstance(ConnectedUsers.class);
Set<String> banList = injector.getInstance(Key.get(new TypeLiteral<Set<String>>(){}, BanList.class));

Expand Down Expand Up @@ -100,7 +100,7 @@ if (banParam != null) {
user.enqueueMessage(qm);

connectedUsers.removeUser(user, DisconnectReason.BANNED);
banList.add(user.getHostName());
banList.add(user.getHostname());
}
response.sendRedirect("admin.jsp");
return;
Expand Down Expand Up @@ -214,7 +214,7 @@ User list:
%>
<tr>
<td><%= u.getNickname() %></td>
<td><%= u.getHostName() %></td>
<td><%= u.getHostname() %></td>
<td>
<a href="?kick=<%= u.getNickname() %>">Kick</a>
<a href="?ban=<%= u.getNickname() %>">Ban</a>
Expand Down
35 changes: 33 additions & 2 deletions WebContent/cah.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012, Andy Janata
* Copyright (c) 2012-2018, Andy Janata
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
Expand All @@ -21,8 +21,11 @@
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

body {
#gamebody {
overflow: hidden;
}

body {
min-height: 640px;
background: #eee;
color: #000;
Expand Down Expand Up @@ -143,6 +146,7 @@ h2,h3,h4 {
border-radius: .25em;
text-transform: uppercase;
font-weight: 700;
white-space: normal;
}

.gamelist_lobby_spectate {
Expand Down Expand Up @@ -240,6 +244,10 @@ h2,h3,h4 {
float: right;
}

#tab-preferences, #tab-gamelist-filters {
overflow-y: auto;
}

.chat {
border: 1px solid black;
left: -1px;
Expand Down Expand Up @@ -634,3 +642,26 @@ span.debug, span.admin {
bottom: 19px;
font-size: 8pt;
}

dfn {
border-bottom: 1px dotted black;
}

#tweetbox {
float: right;
}

.gamelink {
cursor: pointer;
text-decoration: underline;
}

.imagecard {
height: 100%;
width: 100%;
}

.card_text {
word-wrap: break-word;
overflow: hidden;
}
34 changes: 23 additions & 11 deletions WebContent/cardsets.jsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<%--
Copyright (c) 2012, Andy Janata
Copyright (c) 2012-2018, Andy Janata
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
Expand All @@ -27,20 +27,28 @@ Administration tools.
@author Andy Janata ([email protected])
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.google.inject.Injector" %>
<%@ page import="com.google.inject.Key" %>
<%@ page import="com.google.inject.TypeLiteral" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Set" %>
<%@ page import="net.socialgamer.cah.CahModule.Admins" %>
<%@ page import="net.socialgamer.cah.HibernateUtil" %>
<%@ page import="net.socialgamer.cah.StartupUtils" %>
<%@ page import="net.socialgamer.cah.db.PyxBlackCard" %>
<%@ page import="net.socialgamer.cah.db.PyxCardSet" %>
<%@ page import="net.socialgamer.cah.db.PyxWhiteCard" %>
<%@ page import="net.socialgamer.cah.Constants" %>
<%@ page import="net.socialgamer.cah.RequestWrapper" %>
<%@ page import="org.apache.commons.lang3.StringEscapeUtils" %>
<%@ page import="org.hibernate.Session" %>
<%@ page import="org.hibernate.Transaction" %>
<%
RequestWrapper wrapper = new RequestWrapper(request);
if (!Constants.ADMIN_IP_ADDRESSES.contains(wrapper.getRemoteAddr())) {
RequestWrapper wrapper = new RequestWrapper(request);
ServletContext servletContext = pageContext.getServletContext();
Injector injector = (Injector) servletContext.getAttribute(StartupUtils.INJECTOR);
Set<String> admins = injector.getInstance(Key.get(new TypeLiteral<Set<String>>(){}, Admins.class));
if (!admins.contains(wrapper.getRemoteAddr())) {
response.sendError(403, "Access is restricted to known hosts");
return;
}
Expand Down Expand Up @@ -151,7 +159,7 @@ try {
}

@SuppressWarnings("unchecked")
List<PyxCardSet> cardSets = hibernateSession.createQuery("from PyxCardSet order by weight, id")
List<PyxCardSet> cardSets = hibernateSession.createQuery("from PyxCardSet order by weight, name")
.setReadOnly(true).list();

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -242,6 +250,8 @@ select {
<th>Delete</th>
<th>Edit</th>
<th>Weight</th>
<th>Blacks</th>
<th>Whites</th>
<th>Active</th>
</tr>
</thead>
Expand All @@ -254,6 +264,8 @@ select {
<td><a href="?delete=<%=cardSet.getId()%>" onclick="return confirm('Are you sure?')">Delete</a></td>
<td><a href="?edit=<%=cardSet.getId()%>">Edit</a></td>
<td><%=cardSet.getWeight()%></td>
<td><%=cardSet.getBlackCards().size()%></td>
<td><%=cardSet.getWhiteCards().size()%></td>
<td><%=cardSet.isActive()%></td>
</tr>
<%
Expand Down Expand Up @@ -281,11 +293,11 @@ select {
</h2>
<label for="cardSetName">Name:</label>
<input type="text" name="cardSetName" id="cardSetName" size="50"
value="<%=editCardSet != null ? StringEscapeUtils.escapeXml(editCardSet.getName()) : ""%>" />
value="<%=editCardSet != null ? StringEscapeUtils.escapeXml11(editCardSet.getName()) : ""%>" />
<br/>
<label for="cardSetDescription">Description:</label>
<input type="text" name="cardSetDescription" id="cardSetDescription" size="50"
value="<%=editCardSet != null ? StringEscapeUtils.escapeXml(editCardSet.getDescription()) : ""%>" />
value="<%=editCardSet != null ? StringEscapeUtils.escapeXml11(editCardSet.getDescription()) : ""%>" />
<br/>
<label for="cardSetWeight">Weight:</label>
<input type="text" name="cardSetWeight" id="cardSetWeight" size="4"
Expand All @@ -306,7 +318,7 @@ select {
for (PyxBlackCard blackCard : blackCards) {
%>
<option value="<%=blackCard.getId()%>">
<%=StringEscapeUtils.escapeXml(blackCard.toString())%>
<%=StringEscapeUtils.escapeXml11(blackCard.toString())%>
</option>
<%
}
Expand All @@ -326,7 +338,7 @@ select {
for (PyxBlackCard blackCard : editCardSet.getBlackCards()) {
%>
<option value="<%=blackCard.getId()%>" id="bc_<%=blackCard.getId()%>">
<%=StringEscapeUtils.escapeXml(blackCard.toString())%>
<%=StringEscapeUtils.escapeXml11(blackCard.toString())%>
</option>
<%
}
Expand All @@ -343,7 +355,7 @@ select {
for (PyxWhiteCard whiteCard : whiteCards) {
%>
<option value="<%=whiteCard.getId()%>">
<%=StringEscapeUtils.escapeXml(whiteCard.toString())%>
<%=StringEscapeUtils.escapeXml11(whiteCard.toString())%>
</option>
<%
}
Expand All @@ -363,7 +375,7 @@ select {
for (PyxWhiteCard whiteCard : editCardSet.getWhiteCards()) {
%>
<option value="<%= whiteCard.getId() %>" id="wc_<%= whiteCard.getId() %>">
<%= StringEscapeUtils.escapeXml(whiteCard.toString()) %>
<%= StringEscapeUtils.escapeXml11(whiteCard.toString()) %>
</option>
<% } %>
<% } %>
Expand Down
Loading