Commits (2)
<ng-container *ngIf="!standalone">
<ng-container *ngIf="!isProDomain">
<m-v2-topbar *mIfFeature="'top-feeds'; else legacyTopbar">
<ng-container search>
<m-search--bar [defaultSizes]="false"></m-search--bar>
......@@ -30,7 +30,7 @@
<m-body
[class.has-v2-navbar]="featuresService.has('top-feeds')"
[class.is-standalone]="this.standalone"
[class.is-pro-domain]="isProDomain"
>
<m-announcement [id]="'blockchain:sale'" *ngIf="false">
<span
......@@ -45,7 +45,7 @@
<router-outlet></router-outlet>
</m-body>
<m-messenger *ngIf="minds.LoggedIn && !this.standalone"></m-messenger>
<m-messenger *ngIf="minds.LoggedIn && !isProDomain"></m-messenger>
<m-hovercard-popup></m-hovercard-popup>
......@@ -53,10 +53,10 @@
<m--blockchain--transaction-overlay></m--blockchain--transaction-overlay>
<m-modal--tos-updated *ngIf="session.isLoggedIn()"></m-modal--tos-updated>
<m-juryDutySession__summons
*ngIf="session.isLoggedIn() && !this.standalone"
*ngIf="session.isLoggedIn() && !isProDomain"
></m-juryDutySession__summons>
<m-modal-signup-on-scroll *ngIf="!this.standalone"></m-modal-signup-on-scroll>
<m-modal-signup-on-scroll *ngIf="!isProDomain"></m-modal-signup-on-scroll>
<m-channel--onboarding *ngIf="showOnboarding"></m-channel--onboarding>
......
......@@ -18,7 +18,8 @@ import { FeaturesService } from './services/features.service';
import { ThemeService } from './common/services/theme.service';
import { BannedService } from './modules/report/banned/banned.service';
import { DiagnosticsService } from './services/diagnostics.service';
import { STANDALONE_ROUTES } from './modules/pro/pro.module';
import { SiteService } from './services/site.service';
import { PRO_DOMAIN_ROUTES } from './modules/pro/pro.module';
@Component({
moduleId: module.id,
......@@ -35,8 +36,6 @@ export class Minds {
paramsSubscription;
standalone: boolean = false;
constructor(
public session: Session,
public route: ActivatedRoute,
......@@ -56,11 +55,12 @@ export class Minds {
public themeService: ThemeService,
private bannedService: BannedService,
private diagnostics: DiagnosticsService,
private site: SiteService
) {
this.name = 'Minds';
if (window.Minds.pro) {
this.router.resetConfig(STANDALONE_ROUTES);
if (this.site.isProDomain) {
this.router.resetConfig(PRO_DOMAIN_ROUTES);
}
}
......@@ -68,18 +68,16 @@ export class Minds {
this.diagnostics.setUser(this.minds.user);
this.diagnostics.listen(); // Listen for user changes
this.standalone = Boolean(window.Minds.pro);
if (!this.standalone) {
if (!this.site.isProDomain) {
this.notificationService.getNotifications();
}
this.session.isLoggedIn(async is => {
if (is && !this.standalone) {
// TODO remove window.Minds.pro check from this line
if (!this.standalone) {
if (is && !this.site.isProDomain) {
if (!this.site.isProDomain) {
this.showOnboarding = await this.onboardingService.showModal();
}
if (this.minds.user.language !== this.minds.language) {
console.log(
'[app]:: language change',
......@@ -125,4 +123,8 @@ export class Minds {
this.scrollToTop.unlisten();
this.paramsSubscription.unsubscribe();
}
get isProDomain() {
return this.site.isProDomain;
}
}
......@@ -13,7 +13,7 @@ m-body {
margin-top: 52px;
}
&.is-standalone {
&.is-pro-domain {
margin-top: 0;
padding-bottom: 0;
}
......
......@@ -13,6 +13,7 @@ import { MindsChannelResponse } from '../../interfaces/responses';
import { ChannelComponent } from '../channels/channel.component';
import { ProChannelComponent } from '../pro/channel/channel.component';
import { Session } from '../../services/session';
import { SiteService } from '../../services/site.service';
@Component({
selector: 'm-channel-container',
......@@ -38,7 +39,8 @@ export class ChannelContainerComponent implements OnInit, OnDestroy {
protected route: ActivatedRoute,
protected router: Router,
protected client: Client,
protected session: Session
protected session: Session,
protected site: SiteService
) {}
ngOnInit(): void {
......@@ -82,7 +84,7 @@ export class ChannelContainerComponent implements OnInit, OnDestroy {
this.channel = response.channel;
// NOTE: Temporary workaround until channel component supports children routes
if (!window.Minds.pro && this.channel.pro && !this.isOwner) {
if (!this.site.isProDomain && this.channel.pro && !this.isOwner) {
this.router.navigate(['/pro', this.channel.username], {
replaceUrl: true,
});
......
......@@ -62,9 +62,7 @@
]"
[guid]="entity.entity_guid"
[playCount]="entity['play:count']"
[torrent]="[
{ res: '360', key: entity.entity_guid + '/360.mp4' }
]"
[torrent]="[{ res: '360', key: entity.entity_guid + '/360.mp4' }]"
(videoCanPlayThrough)="isLoaded()"
[@slowFadeAnimation]="isLoading ? 'out' : 'in'"
#player
......
import { Component, HostListener, Input, OnDestroy, OnInit, ViewChild, } from '@angular/core';
import {
Component,
HostListener,
Input,
OnDestroy,
OnInit,
ViewChild,
} from '@angular/core';
import { Location } from '@angular/common';
import { Event, NavigationStart, Router } from '@angular/router';
import { animate, state, style, transition, trigger, } from '@angular/animations';
import {
animate,
state,
style,
transition,
trigger,
} from '@angular/animations';
import { Subscription } from 'rxjs';
import { Session } from '../../../services/session';
import { OverlayModalService } from '../../../services/ux/overlay-modal';
......
......@@ -17,6 +17,7 @@ import { NotificationsComponent } from './notifications.component';
import { NotificationService } from './notification.service';
import { NotificationsToasterComponent } from './toaster.component';
import { SiteService } from '../../services/site.service';
@NgModule({
imports: [
......@@ -38,7 +39,7 @@ import { NotificationsToasterComponent } from './toaster.component';
{
provide: NotificationService,
useFactory: NotificationService._,
deps: [Session, Client, SocketsService, MindsTitle],
deps: [Session, Client, SocketsService, MindsTitle, SiteService],
},
],
exports: [
......
......@@ -3,6 +3,7 @@ import { Client } from '../../services/api';
import { SocketsService } from '../../services/sockets';
import { Session } from '../../services/session';
import { MindsTitle } from '../../services/ux/title';
import { SiteService } from '../../services/site.service';
export class NotificationService {
socketSubscriptions: any = {
......@@ -14,20 +15,22 @@ export class NotificationService {
session: Session,
client: Client,
sockets: SocketsService,
title: MindsTitle
title: MindsTitle,
site: SiteService
) {
return new NotificationService(session, client, sockets, title);
return new NotificationService(session, client, sockets, title, site);
}
constructor(
public session: Session,
public client: Client,
public sockets: SocketsService,
public title: MindsTitle
public title: MindsTitle,
protected site: SiteService
) {
if (!window.Minds.notifications_count) window.Minds.notifications_count = 0;
if (!window.Minds.pro) {
if (!this.site.isProDomain) {
this.listen();
}
}
......
......@@ -99,7 +99,7 @@
</ng-container>
<ng-template #ownerNavLinks>
<a
*ngIf="isStandalone"
*ngIf="isProDomain"
class="m-proChannelTopbar__navItem"
[href]="proSettingsHref"
target="root_minds"
......@@ -109,7 +109,7 @@
</a>
<a
*ngIf="!isStandalone"
*ngIf="!isProDomain"
class="m-proChannelTopbar__navItem"
[routerLink]="proSettingsLink"
i18n
......
......@@ -22,7 +22,8 @@ import { SignupModalService } from '../../../modules/modals/signup/service';
import { OverlayModalService } from '../../../services/ux/overlay-modal';
import { ProUnsubscribeModalComponent } from './unsubscribe-modal/modal.component';
import { OverlayModalComponent } from '../../../common/components/overlay-modal/overlay-modal.component';
import { SessionsStorageService } from "../../../services/session-storage.service";
import { SessionsStorageService } from '../../../services/session-storage.service';
import { SiteService } from '../../../services/site.service';
@Component({
providers: [ProChannelService, OverlayModalService],
......@@ -68,12 +69,13 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
protected modal: SignupModalService,
protected modalService: OverlayModalService,
protected sessionStorage: SessionsStorageService,
protected injector: Injector,
protected site: SiteService,
protected injector: Injector
) {}
ngOnInit() {
if (window.Minds.pro) {
this.username = window.Minds.pro.user_guid;
if (this.site.isProDomain) {
this.username = this.site.pro.user_guid;
}
this.listen();
......@@ -133,8 +135,8 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
const title = [
(this.channel.pro_settings.title as string) ||
this.channel.name ||
this.channel.username,
this.channel.name ||
this.channel.username,
];
switch (this.type) {
......@@ -204,7 +206,7 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
if (!this.channel.subscribed) {
if (!this.session.isLoggedIn()) {
this.router.navigate(
window.Minds.pro
this.site.isProDomain
? this.channelService.getRouterLink('login')
: ['/login']
);
......@@ -355,7 +357,7 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
return window.Minds.site_url + 'pro/settings';
}
get isStandalone() {
return Boolean(window.Minds.pro);
get isProDomain() {
return this.site.isProDomain;
}
}
......@@ -8,7 +8,8 @@ import { OverlayModalService } from '../../../services/ux/overlay-modal';
import { Session } from '../../../services/session';
import { ActivatedRoute } from '@angular/router';
import { WireCreatorComponent } from '../../wire/creator/creator.component';
import { SessionsStorageService } from "../../../services/session-storage.service";
import { SessionsStorageService } from '../../../services/session-storage.service';
import { SiteService } from '../../../services/site.service';
export type RouterLinkToType =
| 'home'
......@@ -44,6 +45,7 @@ export class ProChannelService {
protected route: ActivatedRoute,
protected modalService: OverlayModalService,
protected sessionStorage: SessionsStorageService,
protected site: SiteService
) {}
async load(id: string) {
......@@ -103,9 +105,9 @@ export class ProChannelService {
}
async getContent({
limit,
offset,
}: { limit?: number; offset? } = {}): Promise<{
limit,
offset,
}: { limit?: number; offset? } = {}): Promise<{
content: Array<any>;
offset: any;
}> {
......@@ -177,7 +179,7 @@ export class ProChannelService {
const route: any[] = [root];
if (!window.Minds.pro) {
if (!this.site.isProDomain) {
route.push(this.currentChannel.username);
}
......@@ -261,8 +263,8 @@ export class ProChannelService {
}
async auth() {
if (!window.Minds.pro) {
// Not in standalone mode
if (!this.site.isProDomain) {
// Not in Pro domain mode, user already injected
return;
}
......@@ -282,11 +284,11 @@ export class ProChannelService {
this.modalService
.create(WireCreatorComponent, this.currentChannel, {
onComplete: () => {
this.sessionStorage.destroy('pro::wire-modal::open')
this.sessionStorage.destroy('pro::wire-modal::open');
},
})
.onDidDismiss(() => {
this.sessionStorage.destroy('pro::wire-modal::open')
this.sessionStorage.destroy('pro::wire-modal::open');
})
.present();
}
......
......@@ -9,7 +9,7 @@
</a>
<ng-container *ngIf="currentUser">
<ng-container *ngIf="isStandalone">
<ng-container *ngIf="isProDomain">
<a
class="m-pro--channel-footer--link"
[href]="viewProfileHref"
......
......@@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { ProChannelService } from '../channel.service';
import { Session } from '../../../../services/session';
import { AuthService } from '../../../../services/auth.service';
import { SiteService } from '../../../../services/site.service';
export interface SocialProfileMeta {
key: string;
......@@ -20,7 +21,8 @@ export class ProChannelFooterComponent {
constructor(
protected channelService: ProChannelService,
protected session: Session,
protected auth: AuthService
protected auth: AuthService,
protected site: SiteService
) {}
private socialProfileMeta: SocialProfileMeta[] = [
......@@ -304,7 +306,7 @@ export class ProChannelFooterComponent {
return window.Minds.site_url + this.session.getLoggedInUser().username;
}
get isStandalone() {
return Boolean(window.Minds.pro);
get isProDomain() {
return this.site.isProDomain;
}
}
......@@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Subscription } from 'rxjs';
import { Session } from '../../../../services/session';
import { ProChannelService } from '../channel.service';
import { Storage } from "../../../../services/storage";
import { Storage } from '../../../../services/storage';
@Component({
selector: 'm-pro--channel-login',
......@@ -55,7 +55,7 @@ export class ProChannelLoginComponent {
public service: ProChannelService,
private router: Router,
private route: ActivatedRoute,
private storage: Storage,
private storage: Storage
) {
this.paramsSubscription = this.route.params.subscribe(params => {
if (params['username']) {
......
......@@ -14,6 +14,7 @@ import { OverlayModalService } from '../../../../../services/ux/overlay-modal';
import { Router } from '@angular/router';
import { ProChannelService } from '../../channel.service';
import isMobile from '../../../../../helpers/is-mobile';
import { SiteService } from '../../../../../services/site.service';
@Component({
selector: 'm-pro--channel-tile',
......@@ -30,9 +31,9 @@ export class ProTileComponent {
protected featuresService: FeaturesService,
protected channelService: ProChannelService,
protected modalService: OverlayModalService,
protected router: Router
) {
}
protected router: Router,
protected site: SiteService
) {}
getType(entity: any) {
return entity.type === 'object'
......@@ -91,7 +92,7 @@ export class ProTileComponent {
break;
case 'object:blog':
let url = `/blog/${this.entity.slug}-${this.entity.guid}`;
if (!window.Minds.pro) {
if (!this.site.isProDomain) {
url = `${this.channelService.currentChannel.username}/${url}`;
}
this.router.navigate([url]);
......@@ -130,7 +131,10 @@ export class ProTileComponent {
const params: MediaModalParams = { entity: this.entity };
if (window.Minds.pro && this.getType(this.entity) === 'object:blog') {
if (
this.site.isProDomain &&
this.getType(this.entity) === 'object:blog'
) {
params.redirectUrl = `/blog/${this.entity.slug}-${this.entity.guid}`;
}
......
......@@ -71,7 +71,7 @@ const routes: Routes = [
},
];
export const STANDALONE_ROUTES = [
export const PRO_DOMAIN_ROUTES = [
{
path: '',
component: ProChannelComponent,
......
......@@ -46,6 +46,17 @@
</m-tooltip>
</a>
<a
class="m-topbar--navigation--item"
[class.m-topbar--navigation--item-active]="currentTab === 'domain'"
(click)="currentTab = 'domain'"
>
<span i18n>Domain</span>
<m-tooltip icon="help" i18n>
TBD
</m-tooltip>
</a>
<a
class="m-topbar--navigation--item"
[class.m-topbar--navigation--item-active]="currentTab === 'cancel'"
......@@ -73,20 +84,10 @@
<ng-template ngSwitchCase="general">
<p class="m-pro--settings--note" i18n>
Customize your domain, title and headline. This will be used as
your SEO tags as well.
Customize your title and headline. This will be used as your SEO
tags as well.
</p>
<div class="m-pro--settings--field">
<label for="domain" i18n>Domain</label>
<input
type="text"
id="domain"
name="domain"
[(ngModel)]="settings.domain"
/>
</div>
<div class="m-pro--settings--field">
<label for="title" i18n>Title</label>
<input
......@@ -348,6 +349,24 @@
<!-- Cancel -->
<ng-template ngSwitchCase="domain">
<p class="m-pro--settings--note" i18n>
Customize your domain and setup your HTTPS certificates.
</p>
<div class="m-pro--settings--field">
<label for="domain" i18n>Domain</label>
<input
type="text"
id="domain"
name="domain"
[(ngModel)]="settings.domain"
/>
</div>
</ng-template>
<!-- Cancel -->
<ng-template ngSwitchCase="cancel">
<p class="m-pro--settings--note" i18n>
Clicking the button below will take you to Minds Pro page, where
......
......@@ -22,8 +22,13 @@ export class ProSettingsComponent implements OnInit {
saved: boolean = false;
currentTab: 'general' | 'theme' | 'hashtags' | 'footer' | 'cancel' =
'general';
currentTab:
| 'general'
| 'theme'
| 'hashtags'
| 'footer'
| 'domain'
| 'cancel' = 'general';
private currentDraggableEvent: DragEvent;
private currentDragEffectMsg: string;
......
import { Cookie } from '../cookie';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { environment } from '../../../environments/environment';
import { Location } from "@angular/common";
import { Location } from '@angular/common';
import { SiteService } from '../site.service';
/**
* API Class
......@@ -11,12 +12,16 @@ export class Client {
origin: string = '';
cookie: Cookie = new Cookie();
static _(http: HttpClient, location: Location) {
return new Client(http, location);
static _(http: HttpClient, location: Location, site: SiteService) {
return new Client(http, location, site);
}
constructor(public http: HttpClient, public location: Location) {
if (window.Minds.pro) {
constructor(
public http: HttpClient,
public location: Location,
protected site: SiteService
) {
if (this.site.isProDomain) {
this.base = window.Minds.site_url;
this.origin = document.location.host;
}
......
import { Cookie } from '../cookie';
import { HttpClient } from '@angular/common/http';
import { SiteService } from '../site.service';
/**
* API Class
......@@ -9,12 +10,12 @@ export class Upload {
origin: string = '';
cookie: Cookie = new Cookie();
static _(http: HttpClient) {
return new Upload(http);
static _(http: HttpClient, site: SiteService) {
return new Upload(http, site);
}
constructor(public http: HttpClient) {
if (window.Minds.pro) {
constructor(public http: HttpClient, protected site: SiteService) {
if (this.site.isProDomain) {
this.base = window.Minds.site_url;
this.origin = document.location.host;
}
......
......@@ -44,10 +44,11 @@ import { ThemeService } from '../common/services/theme.service';
import { GlobalScrollService } from './ux/global-scroll.service';
import { AuthService } from './auth.service';
import { SiteService } from './site.service';
import { SessionsStorageService } from "./session-storage.service";
import { SessionsStorageService } from './session-storage.service';
import { DiagnosticsService } from './diagnostics.service';
export const MINDS_PROVIDERS: any[] = [
SiteService,
{
provide: ScrollService,
useFactory: ScrollService._,
......@@ -66,12 +67,12 @@ export const MINDS_PROVIDERS: any[] = [
{
provide: Client,
useFactory: Client._,
deps: [HttpClient, Location],
deps: [HttpClient, Location, SiteService],
},
{
provide: Upload,
useFactory: Upload._,
deps: [HttpClient],
deps: [HttpClient, SiteService],
},
{
provide: Storage,
......@@ -148,7 +149,7 @@ export const MINDS_PROVIDERS: any[] = [
{
provide: MindsTitle,
useFactory: MindsTitle._,
deps: [Title],
deps: [Title, SiteService],
},
{
provide: GoogleChartsLoader,
......@@ -233,5 +234,4 @@ export const MINDS_PROVIDERS: any[] = [
},
DiagnosticsService,
AuthService,
SiteService,
];
......@@ -2,11 +2,15 @@ import { Injectable } from '@angular/core';
@Injectable()
export class SiteService {
isProDomain() {
return Boolean(window.Minds.pro);
get pro() {
return window.Minds.pro;
}
get isProDomain() {
return Boolean(this.pro);
}
get title() {
return this.isProDomain() ? window.Minds.pro.title || '' : 'Minds';
return this.isProDomain ? this.pro.title || '' : 'Minds';
}
}
import { Title } from '@angular/platform-browser';
import { SiteService } from '../site.service';
export class MindsTitle {
private counter: number;
......@@ -6,12 +7,12 @@ export class MindsTitle {
private default_title = 'Minds';
private text: string = '';
static _(title: Title) {
return new MindsTitle(title);
static _(title: Title, site: SiteService) {
return new MindsTitle(title, site);
}
constructor(public title: Title) {
if (window.Minds.pro) {
constructor(public title: Title, protected site: SiteService) {
if (this.site.isProDomain) {
this.default_title = '';
}
}
......