Skip to content

Commit

Permalink
Remove a trailing slash in the webapp paths (line#1013)
Browse files Browse the repository at this point in the history
Motivation:

`/app/projects` is more concise and simple than `/app/projects/`

Modifications:

- Set `trailingSlash` to false and revert workarounds to support a
trailing slash.
- Miscellanous) Generated a Central Dogma favicon from
`central_dogma.png` and added to `public/` directory
- Bump Armeria version to 1.30.0

Result:

Paths in the webapp no longer contains a trailing slash.
  • Loading branch information
ikhoon authored Aug 16, 2024
1 parent eb70014 commit 726e187
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ protected HttpResponse doGet(ServiceRequestContext ctx, HttpRequest req) {
.cacheControl(ServerCacheControl.REVALIDATED)
.autoDecompress(true)
.serveCompressedFiles(true)
.fallbackFileExtensions("html")
.build());

sb.serviceUnder("/legacy-web",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ public interface AuthProvider {
* A login page path for the web console. If a user, who has not logged into the web console yet,
* opens the web console, the web browser would bring the user to the login page.
*/
// TODO(ikhoon): Remove the trailing slash once https://github.com/line/armeria/issues/4542 is resolved.
String LOGIN_PATH = "/link/auth/login/";
String LOGIN_PATH = "/link/auth/login";

/**
* A logout page path for the web console. If a user clicks the logout button on the navigation bar,
* the web browser would bring the user to the logout page.
*/
String LOGOUT_PATH = "/link/auth/logout/";
String LOGOUT_PATH = "/link/auth/logout";

/**
* A base path of the built-in web app.
Expand All @@ -57,12 +56,12 @@ public interface AuthProvider {
/**
* A path which provides a built-in HTML login form to a user.
*/
String BUILTIN_WEB_LOGIN_PATH = BUILTIN_WEB_BASE_PATH + "/login/";
String BUILTIN_WEB_LOGIN_PATH = BUILTIN_WEB_BASE_PATH + "/login";

/**
* A path which provides a built-in HTML logout page to a user.
*/
String BUILTIN_WEB_LOGOUT_PATH = BUILTIN_WEB_BASE_PATH + "/logout/";
String BUILTIN_WEB_LOGOUT_PATH = BUILTIN_WEB_BASE_PATH + "/logout";

/**
* A set of {@link Route}s which handles a login request. It is necessary only if
Expand All @@ -85,7 +84,7 @@ public interface AuthProvider {
* the browser would bring a user to the built-in web login page served on {@value BUILTIN_WEB_LOGIN_PATH}.
*/
default HttpService webLoginService() {
// Redirect to the default page: /link/auth/login -> /web/auth/login/
// Redirect to the default page: /link/auth/login -> /web/auth/login
return (ctx, req) -> {
String returnTo = ctx.queryParam("return_to");
if (returnTo != null) {
Expand All @@ -103,7 +102,7 @@ default HttpService webLoginService() {
* {@value BUILTIN_WEB_LOGOUT_PATH}.
*/
default HttpService webLogoutService() {
// Redirect to the default page: /link/auth/logout -> /web/auth/logout/
// Redirect to the default page: /link/auth/logout -> /web/auth/logout
return (ctx, req) -> {
String returnTo = ctx.queryParam("return_to");
if (returnTo != null) {
Expand Down
2 changes: 1 addition & 1 deletion webapp/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
const isDev = process.env.NEXT_ENV === 'development';
const nextConfig = {
productionBrowserSourceMaps: isDev,
trailingSlash: true,
trailingSlash: false,
output: isDev ? 'standalone' : 'export',
distDir: 'build/web/',
images: {
Expand Down
Binary file added webapp/public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webapp/public/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webapp/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webapp/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webapp/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified webapp/public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions webapp/public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
2 changes: 1 addition & 1 deletion webapp/src/dogma/features/auth/Authorized.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const Authorized = (props: { children: ReactNode }) => {
router.push(
process.env.NEXT_PUBLIC_HOST
? `${process.env.NEXT_PUBLIC_HOST}/link/auth/login/?return_to=${window.location.origin}`
: `/link/auth/login/`,
: `/link/auth/login`,
);
}
return <></>;
Expand Down

0 comments on commit 726e187

Please sign in to comment.