diff options
-rw-r--r-- | src/main/java/ru/sape/Sape.java | 3 | ||||
-rw-r--r-- | src/main/java/ru/sape/SapePageLinks.java | 4 | ||||
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 6 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/main/java/ru/sape/Sape.java b/src/main/java/ru/sape/Sape.java index bf975550..83a18331 100644 --- a/src/main/java/ru/sape/Sape.java +++ b/src/main/java/ru/sape/Sape.java @@ -35,10 +35,9 @@ public class Sape { "/code.php?user=" + sapeUser + "&host=" + host, "SAPE_Client PHP", socketTimeout, cacheLifeTime); } - public boolean debug = false; public Optional<SapePageLinks> getPageLinks(URI requestUri, String cookie) { return sapePageLinkConnection.getData() - .map(site -> new SapePageLinks(site, sapeUser, requestUri, cookie, debug)); + .map(site -> new SapePageLinks(site, sapeUser, requestUri, cookie)); } } diff --git a/src/main/java/ru/sape/SapePageLinks.java b/src/main/java/ru/sape/SapePageLinks.java index 6cbfa42f..285d38f6 100644 --- a/src/main/java/ru/sape/SapePageLinks.java +++ b/src/main/java/ru/sape/SapePageLinks.java @@ -31,13 +31,13 @@ public class SapePageLinks { private final String linkDelimiter; private final List<String> pageLinks; - public SapePageLinks(Site site, String sapeUser, URI request, String sapeCookie, boolean showPageCode) { + public SapePageLinks(Site site, String sapeUser, URI request, String sapeCookie) { String req = StringUtils.isNotEmpty(request.getQuery()) ? request.getPath() + "?" + request.getQuery() : request.getPath(); linkDelimiter = site.getDelimiter(); - this.showCode = showPageCode || sapeUser.equals(sapeCookie); + this.showCode = sapeUser.equals(sapeCookie); if (showCode) { pageLinks = Collections.singletonList(site.getCode()); diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 00259f8f..ee726dbf 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -2429,11 +2429,11 @@ public class ServerTests { assertThat(site.getPages().size(), is(3)); assertThat(site.getPages().get(0).getLinks().size(), is(2)); assertThat(site.getCode(), is("<!--1234567890123-->")); - SapePageLinks botLinks = new SapePageLinks(site, "ugnich", URI.create("http://localhost/"), "ugnich", false); + SapePageLinks botLinks = new SapePageLinks(site, "ugnich", URI.create("http://localhost/"), "ugnich"); assertThat(botLinks.render(), is("<sape_noindex><!--1234567890123--></sape_noindex>")); - SapePageLinks visitorLinks = new SapePageLinks(site, "ugnich", URI.create("http://localhost/"), null, false); + SapePageLinks visitorLinks = new SapePageLinks(site, "ugnich", URI.create("http://localhost/"), null); assertThat(visitorLinks.render(), is(" Тест <a href=\"https://example.com\" target=\"_blank\">ссылки</a> - passed. . Тест <a href=\"https://example.com\" target=\"_blank\">ссылки 2</a> - passed. ")); - SapePageLinks emptyLinks = new SapePageLinks(site, "ugnich", URI.create("http://localhost/yo"), null, false); + SapePageLinks emptyLinks = new SapePageLinks(site, "ugnich", URI.create("http://localhost/yo"), null); assertThat(emptyLinks.render(), is(emptyString())); } } |