Skip to content

Commit

Permalink
Merge pull request #614 from NicolasConstant/develop
Browse files Browse the repository at this point in the history
1.6.0 PR
  • Loading branch information
NicolasConstant authored Aug 24, 2023
2 parents c3cd6fe + 0d2ac6b commit 0f58252
Show file tree
Hide file tree
Showing 32 changed files with 1,710 additions and 48 deletions.
1,169 changes: 1,162 additions & 7 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sengi",
"version": "1.5.0",
"version": "1.6.0",
"license": "AGPL-3.0-or-later",
"main": "main-electron.js",
"description": "A multi-account desktop client for Mastodon and Pleroma",
Expand All @@ -25,13 +25,14 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^7.2.7",
"@angular/cdk": "^7.2.7",
"@angular/animations": "^7.2.16",
"@angular/cdk": "^7.3.7",
"@angular/common": "^7.2.7",
"@angular/compiler": "^7.2.7",
"@angular/core": "^7.2.7",
"@angular/forms": "^7.2.7",
"@angular/http": "^7.2.7",
"@angular/material": "^16.2.1",
"@angular/platform-browser": "^7.2.7",
"@angular/platform-browser-dynamic": "^7.2.7",
"@angular/pwa": "^0.12.4",
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { HttpModule } from "@angular/http";
import { HttpClientModule } from '@angular/common/http';
import { NgModule, APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { DragDropModule } from '@angular/cdk/drag-drop';
// import { NgxElectronModule } from 'ngx-electron';

import { NgxsModule } from '@ngxs/store';
Expand Down Expand Up @@ -177,6 +178,7 @@ const routes: Routes = [
OwlDateTimeModule,
OwlNativeDateTimeModule,
OverlayModule,
DragDropModule,
// NgxElectronModule,
RouterModule.forRoot(routes),

Expand Down
2 changes: 2 additions & 0 deletions src/app/components/create-status/create-status.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
this.detectAutosuggestion(value);
this._status = value;

this.languageService.autoDetectLang(value);

setTimeout(() => {
this.autoGrow();
}, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export class PollEditorComponent implements OnInit {
}

private loadPollParameters(poll: Poll) {
if(!this.oldPoll) return;

const isMulti = poll.multiple;

this.entries.length = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ <h2 class="comrade__title" *ngIf="isComrade">Welcome Comrade!</h2>
<button type="submit" class="form-button"
title="add account"
[class.comrade__button]="isComrade">
<span *ngIf="!isLoading">Submit</span>

<span *ngIf="!isLoading && !this.isInstanceMultiAccountLoading">Submit</span>
<span *ngIf="!isLoading && this.isInstanceMultiAccountLoading" class="faq__warning">See FAQ</span>
<app-waiting-animation *ngIf="isLoading" class="waiting-icon"></app-waiting-animation>
</button>

Expand All @@ -29,5 +31,12 @@ <h2 class="comrade__title" *ngIf="isComrade">Welcome Comrade!</h2>
allowfullscreen></iframe>
</div>

<div class="faq" *ngIf="isInstanceMultiAccount">
<p>
FAQ<br/>
<a href="https://github.com/NicolasConstant/sengi/wiki/How-to-add-multiple-accounts-from-the-same-instance" target="_blank">How to add multiple accounts from the same instance?</a>
</p>
</div>

</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,21 @@ $comrade_red: #a50000;
background-color: $comrade_red;
background-position: 0 0;
}
}

.faq {
margin: 20px 0 0 0;

& a {
color: #ffcc00;
text-decoration: underline;

&:hover {
color: #ffe88a;
}
}

&__warning {
color: #ffdc52;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { RegisteredAppsStateModel, AppInfo, AddRegisteredApp } from '../../../st
import { AuthService, CurrentAuthProcess } from '../../../services/auth.service';
import { AppData } from '../../../services/models/mastodon.interfaces';
import { NotificationService } from '../../../services/notification.service';
import { ToolsService } from '../../../services/tools.service';

@Component({
selector: 'app-add-new-account',
templateUrl: './add-new-account.component.html',
styleUrls: ['./add-new-account.component.scss']
})
export class AddNewAccountComponent implements OnInit {
export class AddNewAccountComponent implements OnInit {
private blockList = ['gab.com', 'gab.ai', 'cyzed.com'];
private comradeList = ['juche.town'];

Expand All @@ -24,12 +25,14 @@ export class AddNewAccountComponent implements OnInit {
set setInstance(value: string) {
this.instance = value.replace('http://', '').replace('https://', '').replace('/', '').toLowerCase().trim();
this.checkComrad();
this.checkInstanceMultiAccount(value);
}
get setInstance(): string {
return this.instance;
}

constructor(
private readonly toolsService: ToolsService,
private readonly notificationService: NotificationService,
private readonly authService: AuthService,
private readonly store: Store) { }
Expand All @@ -51,8 +54,27 @@ export class AddNewAccountComponent implements OnInit {
this.isComrade = false;
}

isInstanceMultiAccount: boolean;
isInstanceMultiAccountLoading: boolean;
checkInstanceMultiAccount(value: string) {
if(value) {
const instances: string[] = this.toolsService.getAllAccounts().map(x => x.instance);
if(instances && instances.indexOf(value) > -1){
this.isInstanceMultiAccount = true;
this.isInstanceMultiAccountLoading = true;

setTimeout(() => {
this.isInstanceMultiAccountLoading = false;
}, 2000);
} else {
this.isInstanceMultiAccount = false;
this.isInstanceMultiAccountLoading = false;
}
}
}

onSubmit(): boolean {
if(this.isLoading || !this.instance) return false;
if(this.isLoading || !this.instance || this.isInstanceMultiAccountLoading) return false;

this.isLoading = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,20 @@ <h4 class="panel__subtitle">Languages</h4>
<a href (click)="onRemoveLang(l)" class="form-button language__entry__action sound__play">remove</a>
</div>
<input type="text" (input)="onSearchLang($event.target.value)" [(ngModel)]="searchLang"
placeholder="Find Language" autocomplete="off" class="form-control form-control-sm language__search"/>
placeholder="Find Language" autocomplete="off"
class="form-control form-control-sm language__search" />
<div *ngFor="let l of searchedLangs" class="language__entry">
<span class="language__entry__name">{{ l.name }} ({{l.iso639}})</span>
<a href (click)="onAddLang(l)" class="form-button language__entry__action sound__play">add</a>
</div>


</div>

<input class="sub-section__checkbox" [(ngModel)]="disableLangAutodetectEnabled"
(change)="onDisableLangAutodetectChanged()" type="checkbox" name="disableLangAutodetec"
value="disableLangAutodetec" id="disableLangAutodetec">
<label class="noselect sub-section__label" for="disableLangAutodetec">disable language autodetection</label>
</div>
<h4 class="panel__subtitle">Twitter Bridge</h4>
<div class="sub-section">
Expand Down Expand Up @@ -159,7 +167,8 @@ <h4 class="panel__subtitle">Timelines</h4>

<input class="sub-section__checkbox" [checked]="timeLineHeader === 6" (change)="onTimeLineHeaderChange(6)"
type="radio" name="timelineheader-6" value="timelineheader-6" id="timelineheader-6">
<label class="noselect sub-section__label" for="timelineheader-6">Title - Account Icon - Username - Domain Name</label>
<label class="noselect sub-section__label" for="timelineheader-6">Title - Account Icon - Username - Domain
Name</label>
<br>

<span class="sub-section__title">loading behavior:</span><br />
Expand All @@ -186,7 +195,8 @@ <h4 class="panel__subtitle">Pleroma</h4>
<input class="sub-section__checkbox" [(ngModel)]="autoFollowOnListEnabled"
(change)="onAutoFollowOnListChanged()" type="checkbox" name="onAutoFollowOnListChanged"
value="onAutoFollowOnListChanged" id="onAutoFollowOnListChanged">
<label class="noselect sub-section__label" for="onAutoFollowOnListChanged">autofollow accounts when adding to list</label>
<label class="noselect sub-section__label" for="onAutoFollowOnListChanged">autofollow accounts when
adding to list</label>
<br>
</div>
</div>
Expand All @@ -199,6 +209,20 @@ <h4 class="panel__subtitle">Other</h4>
<label class="noselect sub-section__label" for="disableRemoteFetching">disable remote status
fetching</label>
<br>

<input class="sub-section__checkbox" [(ngModel)]="enableAltLabelEnabled"
(change)="onEnableAltLabelChanged()" type="checkbox" name="enableAltLabel"
value="enableAltLabel" id="enableAltLabel">
<label class="noselect sub-section__label" for="enableAltLabel">enable alt label</label>
<br>

<input class="sub-section__checkbox" [(ngModel)]="enableFreezeAvatarEnabled"
(change)="onEnableFreezeAvatarChanged()" type="checkbox" name="enableFreezeAvatar"
value="enableFreezeAvatar" id="enableFreezeAvatar">
<label class="noselect sub-section__label" for="enableFreezeAvatar">freeze animated avatar</label>
<br>

reorder account's icons: <a href class="toogle-lock-icon-menu" (click)="toogleLockIconMenu()"><span *ngIf="iconMenuLocked">Unlock Icons</span><span *ngIf="!iconMenuLocked">Lock Icons</span></a>
</div>

<h4 class="panel__subtitle">About</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,22 @@
background-color: #32384d;
}
}
}

.toogle-lock-icon-menu {
display: block;
padding: 3px 40px;
width: 170px;

float: right;

text-align: center;

color: white;
background-color: #1f2330;

&:hover {
text-decoration: none;
background-color: #32384d;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export class SettingsComponent implements OnInit, OnDestroy {
disableRemoteStatusFetchingEnabled: boolean;
disableAvatarNotificationsEnabled: boolean;
disableSoundsEnabled: boolean;
disableLangAutodetectEnabled: boolean;
enableAltLabelEnabled: boolean;
enableFreezeAvatarEnabled: boolean;
version: string;

hasPleromaAccount: boolean;
Expand Down Expand Up @@ -146,11 +149,21 @@ export class SettingsComponent implements OnInit, OnDestroy {
this.twitterBridgeInstance = settings.twitterBridgeInstance;

this.configuredLangs = this.languageService.getConfiguredLanguages();
this.disableLangAutodetectEnabled = settings.disableLangAutodetec;
this.enableAltLabelEnabled = settings.enableAltLabel;
this.enableFreezeAvatarEnabled = settings.enableFreezeAvatar;
}

ngOnDestroy(): void {
if(this.languageSub) this.languageSub.unsubscribe();
}
}

iconMenuLocked = true;
toogleLockIconMenu(): boolean {
this.navigationService.changeIconMenuState(this.iconMenuLocked);
this.iconMenuLocked = ! this.iconMenuLocked;
return false;
}

onSearchLang(input: string) {
this.searchedLangs = this.languageService.searchLanguage(input);
Expand Down Expand Up @@ -273,6 +286,27 @@ export class SettingsComponent implements OnInit, OnDestroy {
return false;
}

onEnableFreezeAvatarChanged(){
this.notifyRestartNeeded();
let settings = this.settingsService.getSettings();
settings.enableFreezeAvatar = this.enableFreezeAvatarEnabled;
this.settingsService.saveSettings(settings);
}

onEnableAltLabelChanged(){
this.notifyRestartNeeded();
let settings = this.settingsService.getSettings();
settings.enableAltLabel = this.enableAltLabelEnabled;
this.settingsService.saveSettings(settings);
}

onDisableLangAutodetectChanged() {
this.notifyRestartNeeded();
let settings = this.settingsService.getSettings();
settings.disableLangAutodetec = this.disableLangAutodetectEnabled;
this.settingsService.saveSettings(settings);
}

onDisableAutofocusChanged() {
this.notifyRestartNeeded();
let settings = this.settingsService.getSettings();
Expand Down
27 changes: 18 additions & 9 deletions src/app/components/left-side-bar/left-side-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,36 @@
<fa-icon [icon]="faSearch"></fa-icon>
</a>

<div *ngFor="let account of accounts">
<app-account-icon [account]="account" (toogleAccountNotify)="onToogleAccountNotify($event)"
(openMenuNotify)="onOpenMenuNotify($event)">
</app-account-icon>
<div *ngIf="!iconMenuIsDraggable">
<div *ngFor="let account of accounts">
<app-account-icon [account]="account" (toogleAccountNotify)="onToogleAccountNotify($event)"
(openMenuNotify)="onOpenMenuNotify($event)">
</app-account-icon>
</div>
</div>

<div *ngIf="iconMenuIsDraggable" cdkDropList [cdkDropListData]="accounts" (cdkDropListDropped)="onDrop($event)">
<div *ngFor="let account of accounts" cdkDrag class="draggable">
<fa-icon class="draggable__icon" [icon]="faArrowsAltV"></fa-icon>
<img class="draggable__avatar" src="{{ account.avatar }}" />
</div>
</div>


<a class="left-bar-button left-bar-button--add left-bar-link" [ngClass]="{'no-accounts': hasAccounts === false }"
href title="add new account" (click)="addNewAccount()" (contextmenu)="addNewAccount()">
<fa-icon [icon]="faPlus"></fa-icon>
</a>


<a class="left-bar-button left-bar-button--scheduled left-bar-button--bottom left-bar-link" href title="scheduled statuses"
*ngIf="hasAccounts && hasScheduledStatuses"
(click)="openScheduledStatuses()"
<a class="left-bar-button left-bar-button--scheduled left-bar-button--bottom left-bar-link" href
title="scheduled statuses" *ngIf="hasAccounts && hasScheduledStatuses" (click)="openScheduledStatuses()"
(contextmenu)="openScheduledStatuses()">
<fa-icon [icon]="faCalendarAlt"></fa-icon>
</a>

<a class="left-bar-button left-bar-button--cog left-bar-button--bottom left-bar-link" href title="settings" (click)="openSettings()"
(contextmenu)="openSettings()">
<a class="left-bar-button left-bar-button--cog left-bar-button--bottom left-bar-link" href title="settings"
(click)="openSettings()" (contextmenu)="openSettings()">
<fa-icon [icon]="faCog"></fa-icon>
</a>
</div>
Loading

0 comments on commit 0f58252

Please sign in to comment.