-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/xdnw/locutus
- Loading branch information
Showing
11 changed files
with
70 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 13 additions & 3 deletions
16
src/main/java/link/locutus/discord/web/commands/page/PageHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
package link.locutus.discord.web.commands.page; | ||
|
||
import io.javalin.http.Context; | ||
import link.locutus.discord.commands.manager.v2.binding.WebStore; | ||
import link.locutus.discord.util.MarkupUtil; | ||
import gg.jte.generated.precompiled.auth.JteredirectGenerated; | ||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
public class PageHelper { | ||
public static String redirect(Context context, String url) { | ||
public static String redirect(WebStore ws, Context context, String url) { | ||
context.redirect(url); | ||
context.status(304); | ||
context.status(302); | ||
context.header("cache-control", "no-store"); | ||
return "Redirecting to " + MarkupUtil.htmlUrl(url, url) + ". If you are not redirected, click the link."; | ||
URL urlObj; | ||
try { | ||
urlObj = new URL(url); | ||
} catch (MalformedURLException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return WebStore.render(f -> JteredirectGenerated.render(f, null, ws, urlObj)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@param link.locutus.discord.commands.manager.v2.binding.WebStore ws | ||
@param java.net.URL url | ||
|
||
@template.main(ws = ws, content = @` | ||
Redirecting to <a href="${url.toString()}">${url.toString()}</a> | ||
If you are not redirected, click the link. | ||
`, title = "Redirect", navbar = null) |