mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-05-08 10:50:44 -05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -4,7 +4,6 @@ import org.dreamexposure.discal.client.listeners.discal.CrossTalkEventListener;
|
||||
import org.dreamexposure.discal.client.listeners.discord.ReadyEventListener;
|
||||
import org.dreamexposure.discal.client.message.MessageManager;
|
||||
import org.dreamexposure.discal.client.module.command.*;
|
||||
import org.dreamexposure.discal.client.service.KeepAliveHandler;
|
||||
import org.dreamexposure.discal.core.database.DatabaseManager;
|
||||
import org.dreamexposure.discal.core.logger.Logger;
|
||||
import org.dreamexposure.discal.core.network.google.Authorization;
|
||||
@@ -74,8 +73,6 @@ public class DisCalClient {
|
||||
ClientSocketHandler.setValues(BotSettings.CROSSTALK_SERVER_HOST.get(), Integer.valueOf(BotSettings.CROSSTALK_SERVER_PORT.get()), BotSettings.CROSSTALK_CLIENT_HOST.get(), Integer.valueOf(BotSettings.CROSSTALK_CLIENT_PORT.get()));
|
||||
|
||||
ClientSocketHandler.initListener();
|
||||
|
||||
KeepAliveHandler.startKeepAlive(60);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-1
@@ -1,7 +1,9 @@
|
||||
package org.dreamexposure.discal.client.listeners.discord;
|
||||
|
||||
import org.dreamexposure.discal.client.DisCalClient;
|
||||
import org.dreamexposure.discal.client.message.MessageManager;
|
||||
import org.dreamexposure.discal.client.module.announcement.AnnouncementThreader;
|
||||
import org.dreamexposure.discal.client.service.KeepAliveHandler;
|
||||
import org.dreamexposure.discal.client.service.TimeManager;
|
||||
import org.dreamexposure.discal.core.logger.Logger;
|
||||
import org.dreamexposure.discal.core.utils.GlobalConst;
|
||||
@@ -21,12 +23,15 @@ public class ReadyEventListener {
|
||||
public void onReadyEvent(ReadyEvent event) {
|
||||
Logger.getLogger().debug("Ready!");
|
||||
try {
|
||||
//Start keep-alive
|
||||
KeepAliveHandler.startKeepAlive(60);
|
||||
|
||||
TimeManager.getManager().init();
|
||||
|
||||
//Lets test the new announcement multi-threader...
|
||||
AnnouncementThreader.getThreader().init();
|
||||
|
||||
GlobalConst.iconUrl = event.getClient().getApplicationIconURL();
|
||||
GlobalConst.iconUrl = DisCalClient.getClient().getOurUser().getAvatarURL();
|
||||
|
||||
MessageManager.reloadLangs();
|
||||
|
||||
|
||||
+4
-4
@@ -38,7 +38,7 @@ public class AnnouncementMessageFormatter {
|
||||
*/
|
||||
public static EmbedObject getFormatAnnouncementEmbed(Announcement a, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Announcement.Info.Title", settings));
|
||||
@@ -89,7 +89,7 @@ public class AnnouncementMessageFormatter {
|
||||
*/
|
||||
public static EmbedObject getCondensedAnnouncementEmbed(Announcement a, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Announcement.Condensed.Title", settings));
|
||||
@@ -149,7 +149,7 @@ public class AnnouncementMessageFormatter {
|
||||
*/
|
||||
public static void sendAnnouncementMessage(Announcement announcement, Event event, CalendarData data, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
|
||||
IGuild guild = DisCalClient.getClient().getGuildByID(announcement.getGuildId());
|
||||
@@ -260,7 +260,7 @@ public class AnnouncementMessageFormatter {
|
||||
|
||||
public static void sendAnnouncementDM(Announcement announcement, Event event, IUser user, CalendarData data, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Announcement.Announce.Title", settings));
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ public class CalendarMessageFormatter {
|
||||
|
||||
public static EmbedObject getCalendarLinkEmbed(Calendar cal, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Calendar.Link.Title", settings));
|
||||
@@ -46,7 +46,7 @@ public class CalendarMessageFormatter {
|
||||
*/
|
||||
public static EmbedObject getPreCalendarEmbed(PreCalendar calendar, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Calendar.Pre.Title", settings));
|
||||
|
||||
+4
-4
@@ -41,7 +41,7 @@ public class EventMessageFormatter {
|
||||
public static EmbedObject getEventEmbed(Event event, GuildSettings settings) {
|
||||
EventData ed = DatabaseManager.getManager().getEventData(settings.getGuildID(), event.getId());
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Event.Info.Title", settings));
|
||||
@@ -109,7 +109,7 @@ public class EventMessageFormatter {
|
||||
*/
|
||||
public static EmbedObject getCondensedEventEmbed(Event event, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Event.Condensed.Title", settings));
|
||||
@@ -155,7 +155,7 @@ public class EventMessageFormatter {
|
||||
*/
|
||||
public static EmbedObject getPreEventEmbed(PreEvent event, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Event.Pre.Title", settings));
|
||||
@@ -227,7 +227,7 @@ public class EventMessageFormatter {
|
||||
public static EmbedObject getEventConfirmationEmbed(EventCreatorResponse ecr, GuildSettings settings) {
|
||||
EventData ed = DatabaseManager.getManager().getEventData(settings.getGuildID(), ecr.getEvent().getId());
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Event.Confirm.Title", settings));
|
||||
|
||||
+2
-2
@@ -136,7 +136,7 @@ public class DisCalCommand implements ICommand {
|
||||
IGuild guild = event.getGuild();
|
||||
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.DisCal.Info.Title", settings));
|
||||
@@ -235,7 +235,7 @@ public class DisCalCommand implements ICommand {
|
||||
|
||||
private void moduleSettings(MessageReceivedEvent event, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.DisCal.Settings.Title", settings));
|
||||
|
||||
+1
-1
@@ -734,7 +734,7 @@ public class EventCommand implements ICommand {
|
||||
String value = args[1];
|
||||
if (value.equalsIgnoreCase("list") || value.equalsIgnoreCase("colors") || value.equalsIgnoreCase("colours")) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
|
||||
|
||||
+3
-3
@@ -64,7 +64,7 @@ public class HelpCommand implements ICommand {
|
||||
public boolean issueCommand(String[] args, MessageReceivedEvent event, GuildSettings settings) {
|
||||
if (args.length < 1) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle("DisCal Command Help");
|
||||
@@ -104,7 +104,7 @@ public class HelpCommand implements ICommand {
|
||||
//Embed formatters
|
||||
private EmbedObject getCommandInfoEmbed(ICommand cmd) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.appendField("Command", cmd.getCommand(), true);
|
||||
@@ -129,7 +129,7 @@ public class HelpCommand implements ICommand {
|
||||
|
||||
private EmbedObject getSubCommandEmbed(ICommand cmd, String subCommand) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.appendField("Command", cmd.getCommand(), true);
|
||||
|
||||
+1
-1
@@ -234,7 +234,7 @@ public class RsvpCommand implements ICommand {
|
||||
|
||||
private EmbedObject getRsvpEmbed(RsvpData data, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.RSVP.List.Title", settings));
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public class TimeCommand implements ICommand {
|
||||
|
||||
//Build embed and send.
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.Time.Title", settings));
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ public class GoogleExternalAuth {
|
||||
|
||||
//Send DM to user with code.
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.AddCalendar.Code.Title", settings));
|
||||
@@ -169,7 +169,7 @@ public class GoogleExternalAuth {
|
||||
for (CalendarListEntry i : items) {
|
||||
if (!i.isDeleted()) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(GlobalConst.discalSite);
|
||||
em.withAuthorIcon(GlobalConst.iconUrl);
|
||||
em.withAuthorName("DisCal");
|
||||
em.withAuthorUrl(GlobalConst.discalSite);
|
||||
em.withTitle(MessageManager.getMessage("Embed.AddCalendar.List.Title", settings));
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.TimerTask;
|
||||
* Company Website: https://www.dreamexposure.org
|
||||
* Contact: nova@dreamexposure.org
|
||||
*/
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@SuppressWarnings({"ConstantConditions", "Duplicates"})
|
||||
public class KeepAliveHandler {
|
||||
public static void startKeepAlive(final int seconds) {
|
||||
new Timer(true).scheduleAtFixedRate(new TimerTask() {
|
||||
|
||||
+13
@@ -1,7 +1,11 @@
|
||||
package org.dreamexposure.discal.core.object.network.discal;
|
||||
|
||||
import org.dreamexposure.discal.core.database.DatabaseManager;
|
||||
import org.joda.time.Interval;
|
||||
import org.joda.time.Period;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,6 +17,7 @@ import java.util.List;
|
||||
* Company Website: https://www.dreamexposure.org
|
||||
* Contact: nova@dreamexposure.org
|
||||
*/
|
||||
@SuppressWarnings("Duplicates")
|
||||
public class NetworkInfo {
|
||||
private List<ConnectedClient> clients = new ArrayList<>();
|
||||
|
||||
@@ -58,5 +63,13 @@ public class NetworkInfo {
|
||||
return DatabaseManager.getManager().getAnnouncementCount();
|
||||
}
|
||||
|
||||
public String getUptime() {
|
||||
RuntimeMXBean mxBean = ManagementFactory.getRuntimeMXBean();
|
||||
Interval interval = new Interval(mxBean.getStartTime(), System.currentTimeMillis());
|
||||
Period period = interval.toPeriod();
|
||||
|
||||
return String.format("%d months, %d days, %d hours, %d minutes, %d seconds%n", period.getMonths(), period.getDays(), period.getHours(), period.getMinutes(), period.getSeconds());
|
||||
}
|
||||
|
||||
//Setters
|
||||
}
|
||||
+20
-20
@@ -58,16 +58,16 @@ public class EventEndpoint {
|
||||
Long endEpoch = startEpoch + (86400000L * daysInMonth);
|
||||
GuildSettings settings;
|
||||
|
||||
if (DiscordAccountHandler.getHandler().hasAccount(request)) {
|
||||
if (requestBody.has("guild_id")) {
|
||||
long guildId = Long.valueOf(requestBody.getString("guild_id"));
|
||||
settings = DatabaseManager.getManager().getSettings(guildId);
|
||||
} else {
|
||||
Map m = DiscordAccountHandler.getHandler().getAccount(request);
|
||||
WebGuild g = (WebGuild) m.get("selected");
|
||||
g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
|
||||
settings = g.getSettings();
|
||||
}
|
||||
if (DiscordAccountHandler.getHandler().hasEmbedMap(request)) {
|
||||
Map m = DiscordAccountHandler.getHandler().getEmbedMap(request);
|
||||
WebGuild g = (WebGuild) m.get("embed");
|
||||
g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
|
||||
settings = g.getSettings();
|
||||
} else if (DiscordAccountHandler.getHandler().hasAccount(request)) {
|
||||
Map m = DiscordAccountHandler.getHandler().getAccount(request);
|
||||
WebGuild g = (WebGuild) m.get("selected");
|
||||
g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
|
||||
settings = g.getSettings();
|
||||
} else {
|
||||
long guildId = requestBody.getLong("guild_id");
|
||||
settings = DatabaseManager.getManager().getSettings(guildId);
|
||||
@@ -129,16 +129,16 @@ public class EventEndpoint {
|
||||
Long endEpoch = startEpoch + 86400000L;
|
||||
GuildSettings settings;
|
||||
|
||||
if (DiscordAccountHandler.getHandler().hasAccount(request)) {
|
||||
if (requestBody.has("guild_id")) {
|
||||
long guildId = requestBody.getLong("guild_id");
|
||||
settings = DatabaseManager.getManager().getSettings(guildId);
|
||||
} else {
|
||||
Map m = DiscordAccountHandler.getHandler().getAccount(request);
|
||||
WebGuild g = (WebGuild) m.get("selected");
|
||||
g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
|
||||
settings = g.getSettings();
|
||||
}
|
||||
if (DiscordAccountHandler.getHandler().hasEmbedMap(request)) {
|
||||
Map m = DiscordAccountHandler.getHandler().getEmbedMap(request);
|
||||
WebGuild g = (WebGuild) m.get("embed");
|
||||
g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
|
||||
settings = g.getSettings();
|
||||
} else if (DiscordAccountHandler.getHandler().hasAccount(request)) {
|
||||
Map m = DiscordAccountHandler.getHandler().getAccount(request);
|
||||
WebGuild g = (WebGuild) m.get("selected");
|
||||
g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
|
||||
settings = g.getSettings();
|
||||
} else {
|
||||
long guildId = requestBody.getLong("guild_id");
|
||||
settings = DatabaseManager.getManager().getSettings(guildId);
|
||||
|
||||
+38
-2
@@ -20,6 +20,7 @@ public class DiscordAccountHandler {
|
||||
private static Timer timer;
|
||||
|
||||
private HashMap<String, Map> discordAccounts = new HashMap<>();
|
||||
private HashMap<String, Map> embedMaps = new HashMap<>();
|
||||
|
||||
//Instance handling
|
||||
private DiscordAccountHandler() {
|
||||
@@ -58,6 +59,14 @@ public class DiscordAccountHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasEmbedMap(HttpServletRequest request) {
|
||||
try {
|
||||
return embedMaps.containsKey((String) request.getSession(true).getAttribute("embed"));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Getters
|
||||
public Map getAccount(HttpServletRequest request) {
|
||||
if ((String) request.getSession(true).getAttribute("account") != null && discordAccounts.containsKey((String) request.getSession(true).getAttribute("account"))) {
|
||||
@@ -67,7 +76,12 @@ public class DiscordAccountHandler {
|
||||
|
||||
m.remove("status");
|
||||
m.put("status", DisCalServer.getNetworkInfo());
|
||||
|
||||
//Remove from embed map just in case...
|
||||
removeEmbedMap(request);
|
||||
|
||||
return m;
|
||||
|
||||
} else {
|
||||
//Not logged in...
|
||||
Map m = new HashMap();
|
||||
@@ -76,10 +90,18 @@ public class DiscordAccountHandler {
|
||||
m.put("year", LocalDate.now().getYear());
|
||||
m.put("redirUri", BotSettings.REDIR_URI.get());
|
||||
m.put("status", DisCalServer.getNetworkInfo());
|
||||
|
||||
//Remove from embed map just in case...
|
||||
removeEmbedMap(request);
|
||||
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
public Map getEmbedMap(HttpServletRequest request) {
|
||||
return embedMaps.get((String) request.getSession(true).getAttribute("embed"));
|
||||
}
|
||||
|
||||
public Map getAccountForGuildEmbed(HttpServletRequest request, String guildId) {
|
||||
if ((String) request.getSession(true).getAttribute("account") != null && discordAccounts.containsKey((String) request.getSession(true).getAttribute("account"))) {
|
||||
Map m = discordAccounts.get((String) request.getSession(true).getAttribute("account"));
|
||||
@@ -106,6 +128,11 @@ public class DiscordAccountHandler {
|
||||
m.put("embed", new WebGuild());
|
||||
}
|
||||
|
||||
//Add to embed map...
|
||||
UUID embedKey = UUID.randomUUID();
|
||||
request.getSession(true).setAttribute("embed", embedKey.toString());
|
||||
embedMaps.put(embedKey.toString(), m);
|
||||
|
||||
return m;
|
||||
} else {
|
||||
//Not logged in...
|
||||
@@ -133,6 +160,11 @@ public class DiscordAccountHandler {
|
||||
m.put("embed", new WebGuild());
|
||||
}
|
||||
|
||||
//Add to embed map...
|
||||
UUID embedKey = UUID.randomUUID();
|
||||
request.getSession(true).setAttribute("embed", embedKey.toString());
|
||||
embedMaps.put(embedKey.toString(), m);
|
||||
|
||||
return m;
|
||||
}
|
||||
}
|
||||
@@ -174,9 +206,13 @@ public class DiscordAccountHandler {
|
||||
}
|
||||
|
||||
public void removeAccount(HttpServletRequest request) {
|
||||
if ((String) request.getSession(true).getAttribute("account") != null && hasAccount(request)) {
|
||||
if ((String) request.getSession(true).getAttribute("account") != null && hasAccount(request))
|
||||
discordAccounts.remove((String) request.getSession(true).getAttribute("account"));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeEmbedMap(HttpServletRequest request) {
|
||||
if ((String) request.getSession(true).getAttribute("embed") != null && hasEmbedMap(request))
|
||||
embedMaps.remove((String) request.getSession(true).getAttribute("embed"));
|
||||
}
|
||||
|
||||
private void removeTimedOutAccounts() {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
var calendar = {
|
||||
guildId: 0,
|
||||
todaysDate: new Date(),
|
||||
selectedDate: new Date(),
|
||||
displays: []
|
||||
@@ -147,7 +146,6 @@ function getEventsForMonth() {
|
||||
|
||||
|
||||
var bodyRaw = {
|
||||
"guild_id": calendar.guildId.toString(),
|
||||
"DaysInMonth": daysInMonth().toString(),
|
||||
"StartEpoch": ds.getTime().toString()
|
||||
};
|
||||
@@ -190,7 +188,6 @@ function getEventsForSelectedDate() {
|
||||
|
||||
|
||||
var bodyRaw = {
|
||||
"guild_id": calendar.guildId,
|
||||
"DaysInMonth": daysInMonth().toString(),
|
||||
"StartEpoch": ds.getTime().toString()
|
||||
};
|
||||
@@ -531,9 +528,7 @@ function selectDate(clickedId) {
|
||||
}
|
||||
}
|
||||
|
||||
function init(guildId) {
|
||||
calendar.guildId = parseInt(guildId);
|
||||
|
||||
function init() {
|
||||
setMonth({date: calendar.todaysDate});
|
||||
|
||||
getEventsForMonth();
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<a class="active" href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<a class="active" href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
<a class="active" href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<a class="active" href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a class="active" href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<a class="active" href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
integrity="sha256-lnJeulOa3e5IO2EzHr8jKJ3CbT80MBwkS5a+n2ooIr4=" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
|
||||
<body th:onload="'init(' + ${embed.id} + ')'">
|
||||
<body onload="init()">
|
||||
<div class="top-nav">
|
||||
<a href="/" class="title"><h1>DISCAL</h1></a>
|
||||
<a href="/about">About</a>
|
||||
@@ -64,6 +64,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="https://discord.gg/2TFqyuy" target="_blank">Support</a>
|
||||
<a href="https://www.patreon.com/Novafox" target="_blank">Patreon</a>
|
||||
<a class="active" href="/status">Status</a>
|
||||
|
||||
<a class="account" th:if="${loggedIn}" href="/account/logout">Log out</a>
|
||||
<a class="account" th:unless="${loggedIn}"
|
||||
@@ -62,7 +63,7 @@
|
||||
|
||||
<h2>Server</h2>
|
||||
<p th:text="'Connected Clients: ' + ${status.clientCount}"></p>
|
||||
<p>Uptime: Not yet tracked</p>
|
||||
<p th:text="'Uptime: ' + ${status.uptime}"></p>
|
||||
<p th:text="'Total Guilds: ' + ${status.totalGuildCount}"></p>
|
||||
<p th:text="'Total Calendars: ' + ${status.calendarCount}"></p>
|
||||
<p th:text="'Total Announcements: ' + ${status.announcementCount}"></p>
|
||||
|
||||
Reference in New Issue
Block a user