commit
37325cb188
|
@ -38,11 +38,15 @@ function createWindow() {
|
|||
{ type: "separator" },
|
||||
{ role: "reload" },
|
||||
{ role: "forcereload" },
|
||||
{ type: 'separator' },
|
||||
{ role: 'togglefullscreen' },
|
||||
{ type: "separator" },
|
||||
{ role: "resetzoom" },
|
||||
{ role: "zoomin", accelerator: "CommandOrControl+numadd" },
|
||||
{ role: "zoomout", accelerator: "CommandOrControl+numsub" },
|
||||
{ type: "separator" },
|
||||
{ role: "togglefullscreen" },
|
||||
{ type: "separator" },
|
||||
{ role: "close" },
|
||||
{ role: 'quit' }
|
||||
{ role: "quit" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -191,4 +195,4 @@ app.on("activate", () => {
|
|||
if (win === null) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sengi",
|
||||
"version": "0.28.1",
|
||||
"version": "0.29.0",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"main": "main-electron.js",
|
||||
"description": "A multi-account desktop client for Mastodon and Pleroma",
|
||||
|
|
|
@ -83,6 +83,7 @@ import { ServiceWorkerModule } from '@angular/service-worker';
|
|||
import { environment } from '../environments/environment';
|
||||
import { BookmarksComponent } from './components/floating-column/manage-account/bookmarks/bookmarks.component';
|
||||
import { AttachementImageComponent } from './components/stream/status/attachements/attachement-image/attachement-image.component';
|
||||
import { EnsureHttpsPipe } from './pipes/ensure-https.pipe';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
|
@ -146,7 +147,8 @@ const routes: Routes = [
|
|||
StreamNotificationsComponent,
|
||||
NotificationComponent,
|
||||
BookmarksComponent,
|
||||
AttachementImageComponent
|
||||
AttachementImageComponent,
|
||||
EnsureHttpsPipe
|
||||
],
|
||||
entryComponents: [
|
||||
EmojiPickerComponent
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { Component, OnInit, Input, Output, ElementRef, ViewChild, HostListener } from '@angular/core';
|
||||
import { Component, OnInit, Input, Output, ElementRef, ViewChild, HostListener, OnDestroy } from '@angular/core';
|
||||
import { SafeHtml } from '@angular/platform-browser';
|
||||
import { faTimes, faAngleLeft, faAngleRight } from "@fortawesome/free-solid-svg-icons";
|
||||
import { Subject } from 'rxjs';
|
||||
import { HotkeysService, Hotkey } from 'angular2-hotkeys';
|
||||
|
||||
import { OpenMediaEvent } from '../../models/common.model';
|
||||
import { Attachment, PleromaAttachment } from '../../services/models/mastodon.interfaces';
|
||||
|
@ -12,7 +13,7 @@ import { Attachment, PleromaAttachment } from '../../services/models/mastodon.in
|
|||
templateUrl: './media-viewer.component.html',
|
||||
styleUrls: ['./media-viewer.component.scss']
|
||||
})
|
||||
export class MediaViewerComponent implements OnInit {
|
||||
export class MediaViewerComponent implements OnInit, OnDestroy {
|
||||
private _mediaEvent: OpenMediaEvent;
|
||||
faTimes = faTimes;
|
||||
faAngleLeft = faAngleLeft;
|
||||
|
@ -64,9 +65,20 @@ export class MediaViewerComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
constructor() { }
|
||||
private escapeHotkey = new Hotkey('escape', (event: KeyboardEvent): boolean => {
|
||||
console.warn('CLOSE');
|
||||
this.close();
|
||||
return false;
|
||||
});
|
||||
|
||||
constructor(private readonly hotkeysService: HotkeysService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.hotkeysService.add(this.escapeHotkey);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.hotkeysService.remove(this.escapeHotkey);
|
||||
}
|
||||
|
||||
private setBrowsing() {
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
<a *ngIf="attachment.type === 'image'" class="galery__image--link" title="{{ attachment.description }}"
|
||||
(click)="attachmentSelected()">
|
||||
<img class="galery__image--1" src="{{ attachment.preview_url }}" />
|
||||
<img class="galery__image--1" src="{{ attachment.preview_url | ensureHttps }}" />
|
||||
</a>
|
||||
<video *ngIf="attachment.type === 'gifv'" class="galery__image--link galery__image--1" role="application" loop
|
||||
autoplay (click)="attachmentSelected()">
|
||||
<source src="{{ attachment.url }}" type="video/mp4">
|
||||
<source src="{{ attachment.url | ensureHttps }}" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
|
@ -1,6 +1,6 @@
|
|||
<div class="card-data" *ngIf="card.type === 'link' || card.type === 'video'">
|
||||
<a *ngIf="card.type === 'link'" class="card-data__link" href="{{ card.url }}" target="_blank" title="{{ card.title }} {{ host }}">
|
||||
<img *ngIf="card.image" class="card-data__link--image" src="{{ card.image }}" alt="" />
|
||||
<img *ngIf="card.image" class="card-data__link--image" src="{{ card.image | ensureHttps }}" alt="" />
|
||||
<div *ngIf="!card.image" class="card-data__link--image">
|
||||
<fa-icon class="card-data__link--image--logo" [icon]="faFileAlt"></fa-icon>
|
||||
</div>
|
||||
|
@ -24,7 +24,7 @@
|
|||
<fa-icon [icon]="faExternalLinkAlt"></fa-icon>
|
||||
</a>
|
||||
</div>
|
||||
<img src="{{ card.image }}" class="card-data__video--preview--image" />
|
||||
<img src="{{ card.image | ensureHttps }}" class="card-data__video--preview--image" />
|
||||
</div>
|
||||
<div #video *ngIf="showHtml" class="card-data__video--content" [innerHTML]="html">
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
<div class="reblog" *ngIf="reblog">
|
||||
<a class="reblog__profile-link" href title="{{ status.account.acct }}"
|
||||
(click)="openAccount(status.account)"
|
||||
(auxclick)="openUrl(status.account.url)"><span innerHTML="{{ status.account | accountEmoji }}"></span> <img
|
||||
*ngIf="reblog" class="reblog__avatar" src="{{ status.account.avatar }}" /></a> boosted
|
||||
(auxclick)="openUrl(status.account.url)"><span innerHTML="{{ status.account | accountEmoji }}"></span> <img *ngIf="reblog" class="reblog__avatar" src="{{ status.account.avatar | ensureHttps }}" /></a> boosted
|
||||
</div>
|
||||
<div *ngIf="statusWrapper.status.pinned && !notificationType" class="pinned">
|
||||
<div class="notification--icon">
|
||||
|
@ -50,10 +49,9 @@
|
|||
<div [ngClass]="{'notification--status': notificationAccount }">
|
||||
<a href class="status__profile-link" title="{{displayedStatus.account.acct}}"
|
||||
(click)="openAccount(displayedStatus.account)" (auxclick)="openUrl(displayedStatus.account.url)">
|
||||
<img [class.status__avatar--boosted]="reblog || notificationAccount" class="status__avatar"
|
||||
src="{{ displayedStatus.account.avatar }}" />
|
||||
<img [class.status__avatar--boosted]="reblog || notificationAccount" class="status__avatar" src="{{ displayedStatus.account.avatar | ensureHttps }}" />
|
||||
<!-- <img *ngIf="reblog" class="status__avatar--reblog" src="{{ status.account.avatar }}" /> -->
|
||||
<img *ngIf="notificationAccount" class="notification--avatar" src="{{ notificationAccount.avatar }}" />
|
||||
<img *ngIf="notificationAccount" class="notification--avatar" src="{{ notificationAccount.avatar | ensureHttps }}" />
|
||||
<span class="status__name">
|
||||
<span class="status__name--displayname"
|
||||
innerHTML="{{displayedStatus.account | accountEmoji}}"></span><span
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
import { EnsureHttpsPipe } from './ensure-https.pipe';
|
||||
|
||||
describe('EnsureHttpsPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new EnsureHttpsPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
|
||||
it('support null value', () => {
|
||||
const val = null;
|
||||
const pipe = new EnsureHttpsPipe();
|
||||
const result = pipe.transform(val);
|
||||
|
||||
expect(result).toBe(null);
|
||||
});
|
||||
|
||||
it('support not transform https://', () => {
|
||||
const val = 'https://my-link.com';
|
||||
const pipe = new EnsureHttpsPipe();
|
||||
const result = pipe.transform(val);
|
||||
|
||||
expect(result).toBe(val);
|
||||
});
|
||||
|
||||
it('support transform http:// to https://', () => {
|
||||
const val = 'http://my-link.com';
|
||||
const pipe = new EnsureHttpsPipe();
|
||||
const result = pipe.transform(val);
|
||||
|
||||
expect(result).toBe('https://my-link.com');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'ensureHttps'
|
||||
})
|
||||
export class EnsureHttpsPipe implements PipeTransform {
|
||||
transform(value: string, args?: any): any {
|
||||
if(!value) return value;
|
||||
return value.replace('http://', 'https://');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue