Skip to content

Commit

Permalink
Merge pull request #23166 from mshima/skip_ci-context-path
Browse files Browse the repository at this point in the history
Fixes deploying with context-path
  • Loading branch information
DanielFran authored Aug 14, 2023
2 parents 7ff3f73 + 88fcb87 commit 18f85ee
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 26 deletions.
10 changes: 7 additions & 3 deletions .blueprint/generate-sample/support/generate-sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ export const generateSample = async (
}

// Generate the application
await execa(jhipsterBin, ['--with-entities', '--skip-jhipster-dependencies', '--skip-install', '--no-insight', ...extraArgs], {
stdio: 'inherit',
});
await execa(
jhipsterBin,
['--with-entities', '--skip-jhipster-dependencies', '--skip-install', '--skip-checks', '--no-insight', ...extraArgs],
{
stdio: 'inherit',
},
);
}

await execa(jhipsterBin, ['info'], { stdio: 'inherit' });
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"rules": {
"default-param-last": "off",
"import/no-unresolved": [2, { "ignore": ["^#[\\w\\d/\\-]+$"] }],
"import/prefer-default-export": "off",
"prettier/prettier": "error",
"prefer-regex-literals": "off",
"linebreak-style": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Main page styles
display: inline-block;
width: 347px;
height: 497px;
background: url('/content/images/<%= hipster %>.svg') no-repeat center top;
background: url('../../content/images/<%= hipster %>.svg') no-repeat center top;
background-size: contain;
}

Expand All @@ -35,7 +35,7 @@ Main page styles
only screen and (min-resolution: 192dpi),
only screen and (min-resolution: 2dppx) {
.hipster {
background: url('/content/images/<%= hipster %>.svg') no-repeat center top;
background: url('../../content/images/<%= hipster %>.svg') no-repeat center top;
background-size: contain;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ Logo styles
width: 45px;
display: inline-block;
vertical-align: middle;
background: url('/content/images/logo-jhipster.png') no-repeat center center;
background: url('../../../content/images/logo-jhipster.png') no-repeat center center;
background-size: contain;
}
27 changes: 14 additions & 13 deletions generators/angular/templates/webpack/proxy.conf.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@
limitations under the License.
-%>
function setupProxy({ tls }) {
const conf = [
{
context: [
'/api',
'/services',
'/management',
'/v3/api-docs',
'/h2-console',
const serverResources = [
'/api',
'/services',
'/management',
'/v3/api-docs',
'/h2-console',
<%_ if (authenticationTypeOauth2) { _%>
'/oauth2',
'/login',
'/oauth2',
'/login',
<%_ } _%>
'/auth',
'/health',
],
'/auth',
'/health',
];
const conf = [
{
context: serverResources,
target: `http${tls ? 's' : ''}://localhost:<%= applicationTypeMicroservice ? gatewayServerPort : serverPort %>`,
secure: false,
changeOrigin: tls,
Expand Down
3 changes: 2 additions & 1 deletion generators/base/generator-base-blueprint.mts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { PRIORITY_NAMES } from './priorities.mjs';
import { BaseGeneratorDefinition, GenericTaskGroup } from './tasks.mjs';
import { JHipsterGeneratorFeatures, JHipsterGeneratorOptions } from './api.mjs';
import CoreGenerator from '../base-core/generator-base.mjs';
import { LOCAL_BLUEPRINT_PACKAGE_NAMESPACE } from './support/constants.mjs';

/**
* Base class that contains blueprints support.
Expand Down Expand Up @@ -505,7 +506,7 @@ export default class JHipsterBaseBlueprintGenerator<
extraOptions: ComposeOptions = {},
): Promise<G | undefined> {
blueprint = normalizeBlueprintName(blueprint);
if (!this.skipChecks) {
if (!this.skipChecks && blueprint !== LOCAL_BLUEPRINT_PACKAGE_NAMESPACE) {
this._checkBlueprint(blueprint);
}

Expand Down
1 change: 1 addition & 0 deletions generators/base/support/constants.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const LOCAL_BLUEPRINT_PACKAGE_NAMESPACE = '@jhipster/generator-jhipster-local';
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
left: -8px;
width: 24px;
height: 10px;
background-image: url('/content/images/logo-jhipster.png');
background-image: url('../images/logo-jhipster.png');
background-size: contain;
-webkit-animation: lds-pacman-3 1s linear infinite;
animation: lds-pacman-3 1.5s linear infinite;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<head>
<meta charset="UTF-8" />
<title><%= baseName %> - Swagger UI</title>
<base href="/swagger-ui/"/>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
Expand All @@ -43,6 +44,7 @@
};
window.onload = async function () {
const serverBaseUri = document.baseURI.replace('swagger-ui/', '');
<%_ if (authenticationUsesCsrf) { _%>
function getCSRF() {
var name = 'XSRF-TOKEN=';
Expand All @@ -54,7 +56,10 @@
}
return '';
}
const axiosConfig = { timeout: 5000 };
const axiosConfig = {
timeout: 5000,
baseURL: serverBaseUri,
};
<%_ } else { _%>
const getBearerToken = () => {
var authToken = localStorage.getItem('<%= jhiPrefixDashed %>-authenticationToken') || sessionStorage.getItem('<%= jhiPrefixDashed %>-authenticationToken');
Expand All @@ -68,11 +73,12 @@
};
const axiosConfig = {
timeout: 5000,
baseURL: serverBaseUri,
headers: { Authorization: getBearerToken() },
};
<%_ } _%>
const baseUrl = '/v3/api-docs';
const baseUrl = serverBaseUri + 'v3/api-docs';
let urls;
<%_ if (!applicationTypeMonolith && serviceDiscoveryAny) { _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException;
import org.springframework.web.filter.OncePerRequestFilter;
public class SpaWebFilter extends OncePerRequestFilter {
Expand All @@ -34,7 +33,8 @@ public class SpaWebFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
String path = request.getRequestURI();
// Request URI includes the contextPath if any, removed it.
String path = request.getRequestURI().substring(request.getContextPath().length());
if (
!path.startsWith("/api") &&
!path.startsWith("/management") &&
Expand Down

0 comments on commit 18f85ee

Please sign in to comment.