Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Update #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions iris-lib/src/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,10 +753,13 @@ class Channel {
State.public.user(pub).get(`chats`).get(theirSecretUuid).get(key).on(async (data, a, b, e) => {
if (subscription) { subscription.event = e; }
if (!this.hasWritePermission(pub)) { return; }
const decrypted = await Gun.SEA.decrypt(data, (await this.getTheirGroupSecret(pub)));

//Group Chat causes memory leak. Calles to many gun request/callbacks
//const decrypted = await Gun.SEA.decrypt(data, (await this.getTheirGroupSecret(pub)));
/*
if (decrypted) {
callback(typeof decrypted.v !== `undefined` ? decrypted.v : decrypted, key, pub);
}
}*/
});
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iris-messenger",
"version": "2.3.3",
"version": "2.3.3.9.9",
"license": "MIT",
"scripts": {
"build": "preact build --no-prerender",
Expand Down Expand Up @@ -58,7 +58,7 @@
"history": "5.3.0",
"htm": "^3.1.1",
"identicon.js": "^2.3.3",
"iris-lib": "file:./iris-lib",
"iris-lib": "./iris-lib",
"jquery": "^3.6.1",
"jsxstyle": "^2.5.1",
"localforage": "^1.10.0",
Expand All @@ -85,4 +85,4 @@
"resolutions": {
"styled-components": "^5"
}
}
}
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 31 additions & 1 deletion src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,37 @@ small, .text-muted {
.chat-item.new svg,.chat-new-item svg{
color: var(--small-text-color);
}

.tmpprofilephoto{
height: 40px;
width: 40px;
background-color: var(--main-color);
border-radius: 50%;
display: inline-block;
}
.tmpMsgSenderName{
height: 20px;
width: 100px;
background-color: var(--main-color);
border-radius: 10px;
display: inline-block;
margin-left: 15px;
}
.tmpimg{
height: 200px;
width: 200px;
background-color: var(--main-color);
border-radius: 10px;
display: inline-block;
}
.tmptext{
height: 20px;
width: 300px;
background-color: var(--main-color);
border-radius: 10px;
display: inline-block;
margin-left: 15px;
margin-bottom: 5px;
}
#new-chat input {
width: 200px;
}
Expand Down
48 changes: 3 additions & 45 deletions src/js/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from './BaseComponent';
import { Router, RouterOnChangeArgs, CustomHistory } from 'preact-router';
import AsyncRoute from 'preact-async-route';

import { createHashHistory } from 'history';
import {Helmet} from "react-helmet";
import { translationLoaded } from "./translations/Translation";
Expand All @@ -16,21 +16,14 @@ import Hashtags from './views/Hashtags';
import Login from './views/Login';
import Profile from './views/Profile';
import Group from './views/Group';
import Message from './views/Message';
import Follows from './views/Follows';
import Feed from './views/Feed';

import About from './views/About';
import Contacts from './views/Contacts';
import Torrent from './views/Torrent';

import Menu from './components/Menu';
import VideoCall from './components/VideoCall';
import MediaPlayer from './components/MediaPlayer';
import Footer from './components/Footer';

import State from 'iris-lib/src/State';
import Session from 'iris-lib/src/Session';

import '../css/style.css';
import '../css/cropper.min.css';

Expand Down Expand Up @@ -123,7 +116,6 @@ class Main extends Component<Props,ReactState> {
</div>
) : null}
<section className={`main ${isDesktopNonMac ? 'desktop-non-mac' : ''} ${s.showMenu ? 'menu-visible-xs' : ''}`} style="flex-direction: row;">
<Menu/>
<Helmet titleTemplate={titleTemplate} defaultTitle={defaultTitle}>
<title>{title}</title>
<meta name="description" content="Social Networking Freedom" />
Expand All @@ -137,19 +129,13 @@ class Main extends Component<Props,ReactState> {
<div className="overlay" onClick={() => this.onClickOverlay()}></div>
<div className="view-area">
<Router history={history as CustomHistory} onChange={e => this.handleRoute(e)}>
<Feed path="/"/>
<Feed path="/feed"/>
<Hashtags path="/hashtag"/>
<Feed path="/hashtag/:hashtag+"/>
<Feed path="/search/:term?/:type?"/>
<Feed path="/media" index="media" thumbnails/>
<Login path="/login"/>
<Notifications path="/notifications"/>
<Chat path="/chat/hashtag/:hashtag?"/>
<Chat path="/chat/:id?"/>
<Chat path="/chat/new/:id"/>
<Message path="/post/:hash+"/>
<Torrent path="/torrent/:id+"/>
<Chat path="/"/>
<About path="/about"/>
<Settings path="/settings/:page?"/>
<LogoutConfirmation path="/logout"/>
Expand All @@ -160,41 +146,13 @@ class Main extends Component<Props,ReactState> {
<Profile path="/nfts/:id+" tab="nfts"/>
<Group path="/group/:id+"/>
{/* Lazy load stuff that is used less often */}
<AsyncRoute
path="/store/:store?"
getComponent={() => import('./views/Store').then(module => module.default)}
/>
<AsyncRoute
path="/checkout/:store?"
getComponent={() => import('./views/Checkout').then(module => module.default)}
/>
<AsyncRoute
path="/product/:product/:store"
getComponent={() => import('./views/Product').then(module => module.default)}
/>
<AsyncRoute
path="/product/new"
store={Session.getPubKey()}
getComponent={() => import('./views/Product').then(module => module.default)}
/>
<AsyncRoute
path="/explorer/:node"
getComponent={() => import('./views/Explorer').then(module => module.default)}
/>
<AsyncRoute
path="/explorer"
store={Session.getPubKey()}
getComponent={() => import('./views/Explorer').then(module => module.default)}
/>
<Follows path="/follows/:id"/>
<Follows followers={true} path="/followers/:id"/>
<Contacts path="/contacts"/>
</Router>
</div>
</section>
<MediaPlayer/>
<Footer/>
<VideoCall/>
</div>
);
}
Expand Down
2 changes: 0 additions & 2 deletions src/js/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ class Footer extends Component<Props, State> {
return (
<footer class="visible-xs-flex nav footer">
<div class="header-content" onClick={() => State.local.get('scrollUp').put(true)}>
<a href="/" class={`btn ${activeRoute === '/' ? 'active' : ''}`}>{Icons.home}</a>
<a href="/chat" class={`btn ${activeRoute.indexOf('/chat') === 0 ? 'active' : ''}`}>
{this.state.unseenMsgsTotal ? <span class="unseen unseen-total">{this.state.unseenMsgsTotal}</span>: ''}
{Icons.chat}
</a>
<a href="/post/new" class={`btn ${activeRoute === '/post/new' ? 'active' : ''}`}>{plusIcon}</a>
<a href="/contacts" class={`btn ${activeRoute === '/contacts' ? 'active' : ''}`}>{Icons.user}</a>
<a href={`/profile/${key}`} class={`${activeRoute === `/profile/${ key}` ? 'active' : ''} my-profile`}>
<Identicon str={key} width={34} />
Expand Down
18 changes: 10 additions & 8 deletions src/js/components/Header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Component from '../BaseComponent';
import Helpers from '../Helpers';
import { html } from 'htm/preact';
import { translate as t } from '../translations/Translation';
import State from 'iris-lib/src/State';
Expand Down Expand Up @@ -137,13 +136,7 @@ class Header extends Component {
</div>
` : ''}
<div class="header-content">
<div class="mobile-search-hidden ${this.state.showMobileSearch ? 'hidden-xs':''}">
${Helpers.isElectron || chatting ? '' : html`
<a href="/" onClick=${e => this.onLogoClick(e)} class="visible-xs-flex logo">
<div class="mobile-menu-icon">${Icons.menu}</div>
</a>
`}
</div>

${chatting ? '' : html`
<a class="mobile-search-visible ${this.state.showMobileSearch ? '' : 'hidden-xs'}" href="" onClick=${e => {
e.preventDefault();
Expand All @@ -152,6 +145,15 @@ class Header extends Component {
<span class="visible-xs-inline-block">${Icons.backArrow}</span>
</a>
`}
${
window.innerWidth > 624 ? html`
<a href="/" style="margin-right: 15px;">
<small>
<span class="icon">${Icons.home}</span>
</small>
</a>`
: ''
}
<a href="/settings/peer" class="connected-peers tooltip mobile-search-hidden ${this.state.showMobileSearch ? 'hidden-xs' : ''} ${peerCount ? 'connected' : ''}">
<span class="tooltiptext">${t('connected_peers')}</span>
<small>
Expand Down
4 changes: 0 additions & 4 deletions src/js/components/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Component from '../BaseComponent';
import Helpers from '../Helpers';
import { html } from 'htm/preact';
import Session from 'iris-lib/src/Session';
import Torrent from './Torrent';
import Autolinker from 'autolinker';
import $ from 'jquery';
import State from 'iris-lib/src/State';
Expand Down Expand Up @@ -169,9 +168,6 @@ class Message extends Component {
<div class="msg-sender">
${name && this.props.showName && html`<small onclick=${() => this.onNameClick()} class="msgSenderName" style="color: ${color}">${name}</small>`}
</div>
${this.props.torrentId ? html`
<${Torrent} torrentId=${this.props.torrentId}/>
`:''}
${this.props.attachments && this.props.attachments.map(a =>
html`<div class="img-container"><img src=${a.data} onclick=${e => { this.openAttachmentsGallery(e); }}/></div>` // TODO: escape a.data
)}
Expand Down
80 changes: 80 additions & 0 deletions src/js/components/NotificationsComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { html } from 'htm/preact';
import State from 'iris-lib/src/State';
import Identicon from '../components/Identicon';
import Button from '../components/basic/Button';
import {translate as t} from '../translations/Translation';
import Name from '../components/Name';
import NotificationTools from "iris-lib/src/Notifications";
import util from "iris-lib/src/util";
import { Component } from 'preact';
const PAGE_SIZE = 10;

export default class NotificationsComponent extends Component{
notifications = {};
class = 'public-messages-view';
state = {
displayCount: PAGE_SIZE
}

componentDidMount() {
NotificationTools.changeUnseenNotificationCount(0);
State.local.get('notifications').map(
(notification, time) => {
if (notification) {
this.notifications[time] = notification;
NotificationTools.getNotificationText(notification).then(text => {
this.notifications[time].text = text;
this.setState({});
});
} else {
delete this.notifications[time];
}
this.setState({d:new Date().toISOString()});
}
);
}

shouldComponentUpdate() {
return true;
}

render() {
const displayCount = this.state.displayCount;
const notificationKeys = Object.keys(this.notifications).sort().reverse();
return html`
<div class="centered-container" style="margin-bottom: 15px;">
<h3>${t('notifications')}</h3>

${Object.keys(this.notifications).length === 0 ? html`
<p> ${t('no_notifications_yet')}</p>
`:''}
${notificationKeys.slice(0, this.state.displayCount).map(k => {
const notification = this.notifications[k];
return html`
<div class="msg" key=${(notification.time||'') + (notification.from||'') + (notification.target||'')}>
<div class="msg-content">
<div class="msg-sender">
<a class="msg-sender-link" href="/profile/${notification.from}">
<${Identicon} str=${notification.from} width=30 />${' '}
<small class="msgSenderName"><${Name} pub=${notification.from} /></small>
</a>
</div>
${notification.text || ''}
<div class="below-text">
<div class="time">${util.formatDate(new Date(notification.time))}</div><br/>
</div>
</div>
</div>
`;
})}
${displayCount < notificationKeys.length ? html`
<div>
<${Button} onClick=${() => this.setState({displayCount: displayCount + PAGE_SIZE})}>
${t('show_more')}
<//>
</div>
` : ''}
</div>
`;
}
}
32 changes: 0 additions & 32 deletions src/js/views/Message.js

This file was deleted.

Loading