Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-support-for-sub-paths
Browse files Browse the repository at this point in the history
  • Loading branch information
reey authored Apr 15, 2024
2 parents 11e9f29 + 66c5214 commit 51b9b7c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/src/app/cloud-http-proxy/cloud-http-proxy.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { CommonModule } from '@angular/common';
import { CloudHttpProxyComponent } from './cloud-http-proxy.component';
import { ViewContext, hookRoute, hookTab } from '@c8y/ngx-components';
import { CloudHttpProxyTabFactory } from './cloud-http-proxy-tab.factory';
import { UnlockPassthroughFeatureModule } from '../unlock-passthrough-feature/unlock-passthrough-feature.module';

@NgModule({
imports: [CommonModule, CloudHttpProxyComponent],
imports: [CommonModule, CloudHttpProxyComponent, UnlockPassthroughFeatureModule],
providers: [
hookRoute([
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { EnvironmentInjector, NgModule } from '@angular/core';
import { NavigationStart, Router, RouterModule } from '@angular/router';
import { filter, first } from 'rxjs/operators';

@NgModule({
imports: [
RouterModule.forChild([])
]
})
export class UnlockPassthroughFeatureModule {
constructor(private injector: EnvironmentInjector, private router: Router) {
this.router.events
.pipe(
filter(e => e instanceof NavigationStart),
first()
)
.subscribe(() => {
const angularJsInjector = this.injector.get('$injector', null);
if (angularJsInjector) {
const c8ySettings = angularJsInjector.get('c8ySettings');
const q = angularJsInjector.get('$q');
if (c8ySettings && q) {
const originalGetSystemOptionValueFn = c8ySettings.getSystemOptionValue;

c8ySettings.getSystemOptionValue = (optionDetails: any, ...others: any[]) => {
if (
optionDetails &&
optionDetails.category === 'remoteaccess' &&
optionDetails.key === 'pass-through.enabled'
) {
return q.resolve(true);
}
return originalGetSystemOptionValueFn(optionDetails, ...others);
};
}
}
});
}
}

0 comments on commit 51b9b7c

Please sign in to comment.