import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.sone.web.page.FreenetTemplatePage;
import net.pterodactylus.util.notify.Notification;
-import net.pterodactylus.util.object.HashCode;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
import freenet.clients.http.SessionManager.Session;
import freenet.clients.http.ToadletContext;
import freenet.support.api.HTTPRequest;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
/**
* Base page for the Sone web interface.
*
// TEMPLATEPAGE METHODS
//
- /**
- * {@inheritDoc}
- */
@Override
protected String getPageTitle(FreenetRequest request) {
if (pageTitleKey != null) {
return "";
}
- /**
- * {@inheritDoc}
- */
@Override
protected List<Map<String, String>> getAdditionalLinkNodes(FreenetRequest request) {
return ImmutableList.<Map<String, String>> builder().add(ImmutableMap.<String, String> builder().put("rel", "search").put("type", "application/opensearchdescription+xml").put("title", "Sone").put("href", "http://" + request.getHttpRequest().getHeader("host") + "/Sone/OpenSearch.xml").build()).build();
}
- /**
- * {@inheritDoc}
- */
@Override
protected Collection<String> getStyleSheets() {
return Arrays.asList("css/sone.css");
}
- /**
- * {@inheritDoc}
- */
@Override
protected String getShortcutIcon() {
return "images/icon.png";
return requireLogin;
}
- /**
- * {@inheritDoc}
- */
@Override
protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
super.processTemplate(request, templateContext);
List<Notification> notifications = ListNotificationFilters.filterNotifications(webInterface.getNotifications().getNotifications(), currentSone);
Collections.sort(notifications, Notification.CREATED_TIME_SORTER);
templateContext.set("notifications", notifications);
- templateContext.set("notificationHash", HashCode.hashCode(notifications));
+ templateContext.set("notificationHash", notifications.hashCode());
}
- /**
- * {@inheritDoc}
- */
@Override
protected String getRedirectTarget(FreenetRequest request) {
if (requiresLogin() && (getCurrentSone(request.getToadletContext(), false) == null)) {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
protected boolean isFullAccessOnly() {
return webInterface.getCore().getPreferences().isRequireFullAccess();
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean isEnabled(ToadletContext toadletContext) {
if (webInterface.getCore().getPreferences().isRequireFullAccess() && !toadletContext.isAllowedFullAccess()) {