mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
Make the wrapper more generic in the event we support other wrappers
This commit is contained in:
parent
751e1b9c8c
commit
c5146d84ff
@ -21,6 +21,7 @@ Change the values in Riot's `config.json` as shown below. If you do not have a `
|
|||||||
```
|
```
|
||||||
"integrations_ui_url": "https://dimension.t2bot.io/riot",
|
"integrations_ui_url": "https://dimension.t2bot.io/riot",
|
||||||
"integrations_rest_url": "https://dimension.t2bot.io/api/v1/scalar",
|
"integrations_rest_url": "https://dimension.t2bot.io/api/v1/scalar",
|
||||||
|
"integrations_widgets_urls": ["https://dimension.t2bot.io/widgets"],
|
||||||
```
|
```
|
||||||
|
|
||||||
The remaining settings should be tailored for your Riot deployment.
|
The remaining settings should be tailored for your Riot deployment.
|
||||||
|
@ -32,7 +32,7 @@ class Dimension {
|
|||||||
this._app.use(bodyParser.json());
|
this._app.use(bodyParser.json());
|
||||||
|
|
||||||
// Register routes for angular app
|
// Register routes for angular app
|
||||||
this._app.get(['/riot', '/riot/*', '/widget_wrapper', '/widget_wrapper/*'], (req, res) => {
|
this._app.get(['/riot', '/riot/*', '/widgets', '/widgets/*'], (req, res) => {
|
||||||
res.sendFile(path.join(__dirname, "..", "web-dist", "index.html"));
|
res.sendFile(path.join(__dirname, "..", "web-dist", "index.html"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import { IrcApiService } from "./shared/irc-api.service";
|
|||||||
import { TravisCiConfigComponent } from "./configs/travisci/travisci-config.component";
|
import { TravisCiConfigComponent } from "./configs/travisci/travisci-config.component";
|
||||||
import { CustomWidgetConfigComponent } from "./configs/widget/custom_widget/custom_widget-config.component";
|
import { CustomWidgetConfigComponent } from "./configs/widget/custom_widget/custom_widget-config.component";
|
||||||
import { MyFilterPipe } from "./shared/my-filter.pipe";
|
import { MyFilterPipe } from "./shared/my-filter.pipe";
|
||||||
import { WidgetWrapperComponent } from "./widget_wrapper/widget_wrapper.component";
|
import { GenericWidgetWrapperComponent } from "./widget_wrappers/generic/generic.component";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@ -50,7 +50,7 @@ import { WidgetWrapperComponent } from "./widget_wrapper/widget_wrapper.componen
|
|||||||
TravisCiConfigComponent,
|
TravisCiConfigComponent,
|
||||||
CustomWidgetConfigComponent,
|
CustomWidgetConfigComponent,
|
||||||
MyFilterPipe,
|
MyFilterPipe,
|
||||||
WidgetWrapperComponent,
|
GenericWidgetWrapperComponent,
|
||||||
|
|
||||||
// Vendor
|
// Vendor
|
||||||
],
|
],
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { RouterModule, Routes } from "@angular/router";
|
import { RouterModule, Routes } from "@angular/router";
|
||||||
import { HomeComponent } from "./home/home.component";
|
import { HomeComponent } from "./home/home.component";
|
||||||
import { RiotComponent } from "./riot/riot.component";
|
import { RiotComponent } from "./riot/riot.component";
|
||||||
import { WidgetWrapperComponent } from "./widget_wrapper/widget_wrapper.component";
|
import { GenericWidgetWrapperComponent } from "./widget_wrappers/generic/generic.component";
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{path: "", component: HomeComponent},
|
{path: "", component: HomeComponent},
|
||||||
{path: "riot", component: RiotComponent},
|
{path: "riot", component: RiotComponent},
|
||||||
{path: "riot/widget_wrapper", component: WidgetWrapperComponent},
|
{path: "widgets/generic", component: GenericWidgetWrapperComponent},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const routing = RouterModule.forRoot(routes);
|
export const routing = RouterModule.forRoot(routes);
|
||||||
|
@ -40,7 +40,7 @@ export class CustomWidgetConfigComponent extends WidgetComponent implements Moda
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.wrapperUrl = window.location.origin + "/riot/widget_wrapper?url=";
|
this.wrapperUrl = window.location.origin + "/widgets/generic?url=";
|
||||||
}
|
}
|
||||||
|
|
||||||
private getWrappedUrl(url: string): string {
|
private getWrappedUrl(url: string): string {
|
||||||
|
@ -10,8 +10,9 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<p>Point your Riot <code>config.json</code> to Dimension to start using it:</p>
|
<p>Point your Riot <code>config.json</code> to Dimension to start using it:</p>
|
||||||
<pre>
|
<pre>
|
||||||
"integrations_ui_url": "https://dimension.t2bot.io/riot"
|
"integrations_ui_url": "https://dimension.t2bot.io/riot",
|
||||||
"integrations_rest_url": "https://dimension.t2bot.io/api/v1/scalar"
|
"integrations_rest_url": "https://dimension.t2bot.io/api/v1/scalar",
|
||||||
|
"integrations_widgets_urls": ["https://dimension.t2bot.io/widgets"],
|
||||||
</pre>
|
</pre>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { Component } from "@angular/core";
|
import { Component } from "@angular/core";
|
||||||
import { ApiService } from "../shared/api.service";
|
import { ApiService } from "../../shared/api.service";
|
||||||
import { ActivatedRoute } from "@angular/router";
|
import { ActivatedRoute } from "@angular/router";
|
||||||
import { DomSanitizer, SafeUrl } from "@angular/platform-browser";
|
import { DomSanitizer, SafeUrl } from "@angular/platform-browser";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "my-widget-wrapper",
|
selector: "my-generic-widget-wrapper",
|
||||||
templateUrl: "widget_wrapper.component.html",
|
templateUrl: "generic.component.html",
|
||||||
styleUrls: ["widget_wrapper.component.scss"],
|
styleUrls: ["generic.component.scss"],
|
||||||
})
|
})
|
||||||
export class WidgetWrapperComponent {
|
export class GenericWidgetWrapperComponent {
|
||||||
|
|
||||||
public isLoading = true;
|
public isLoading = true;
|
||||||
public canEmbed = false;
|
public canEmbed = false;
|
Loading…
Reference in New Issue
Block a user