mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-19 17:46:33 +00:00
electron nearby user discovery, webpack build notifier
This commit is contained in:
parent
3d1c53a848
commit
ca6272d5db
@ -39,7 +39,8 @@
|
||||
"jest": "^27.0.6",
|
||||
"jest-preset-preact": "^4.0.5",
|
||||
"preact-cli": "^3.2.2",
|
||||
"sirv-cli": "1.0.14"
|
||||
"sirv-cli": "1.0.14",
|
||||
"webpack-build-notifier": "^2.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@zxing/library": "^0.18.6",
|
||||
|
@ -1,5 +1,18 @@
|
||||
const WebpackBuildNotifierPlugin = require('webpack-build-notifier');
|
||||
const path = require('path');
|
||||
|
||||
export default {
|
||||
webpack(config, env, helpers, options) {
|
||||
config.node = { fs: 'empty' };
|
||||
config.plugins = config.plugins || [];
|
||||
config.plugins.push(
|
||||
new WebpackBuildNotifierPlugin({
|
||||
title: "Iris Webpack Build",
|
||||
logo: path.resolve("./src/assets/img/icon128.png"),
|
||||
suppressSuccess: true, // don't spam success notifications
|
||||
warningSound: false,
|
||||
suppressWarning: true,
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
@ -225,12 +225,15 @@ function login(k) {
|
||||
if (shouldRefresh) {
|
||||
location.reload();
|
||||
}
|
||||
State.electron && State.electron.get('settings').on(electron => {
|
||||
if (State.electron) {
|
||||
State.electron.get('settings').on(electron => {
|
||||
settings.electron = electron;
|
||||
if (electron.publicIp) {
|
||||
Object.values(channels).forEach(shareMyPeerUrl);
|
||||
}
|
||||
});
|
||||
State.electron.get('user').put(key.pub);
|
||||
}
|
||||
State.local.get('settings').on(local => {
|
||||
settings.local = local;
|
||||
});
|
||||
@ -276,6 +279,9 @@ function getMyName() { return myName; }
|
||||
function getMyProfilePhoto() { return myProfilePhoto; }
|
||||
|
||||
async function logOut() {
|
||||
if (State.electron) {
|
||||
State.electron.get('user').put(null);
|
||||
}
|
||||
// TODO: remove subscription from your channels
|
||||
if (navigator.serviceWorker) {
|
||||
const reg = await navigator.serviceWorker.getRegistration();
|
||||
|
@ -15,7 +15,11 @@ class Contacts extends View {
|
||||
this.id = "contacts-view";
|
||||
}
|
||||
|
||||
getContacts() {
|
||||
shouldComponentUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const f = Session.getFollows();
|
||||
State.local.get('groups').get('everyone').map().on(this.sub(
|
||||
(isContact, pub) => {
|
||||
@ -29,14 +33,37 @@ class Contacts extends View {
|
||||
this.setState({});
|
||||
}
|
||||
));
|
||||
State.electron && State.electron.get('bonjour').on(s => {
|
||||
const nearbyUsers = JSON.parse(s);
|
||||
console.log('nearbyUsers', nearbyUsers);
|
||||
this.setState({nearbyUsers});
|
||||
});
|
||||
}
|
||||
|
||||
shouldComponentUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getContacts();
|
||||
renderNearbyUsers() {
|
||||
return this.state.nearbyUsers.map(peer => {
|
||||
const k = peer.txt && peer.txt.user;
|
||||
if (!k) { return html`<p>${peer.name}</p>`; }
|
||||
return html`
|
||||
<div class="profile-link-container">
|
||||
${k ? html`
|
||||
<div class="">
|
||||
<a href="/profile/${k}" class="profile-link">
|
||||
<${Identicon} key="i${k}" str=${k} width=49/>
|
||||
<div>
|
||||
<${Name} key="k${k}" pub=${k}/><br/>
|
||||
<small class="follower-count">
|
||||
${peer.name}<br/>
|
||||
${this.contacts[k] && this.contacts[k].followers && this.contacts[k].followers.size || '0'} ${t('followers')}
|
||||
</small>
|
||||
</div>
|
||||
</a>
|
||||
${k !== Session.getPubKey() ? html`<${FollowButton} key="f${k}" id=${k}/>` : ''}
|
||||
</div>
|
||||
`:''}
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
renderView() {
|
||||
@ -56,6 +83,11 @@ class Contacts extends View {
|
||||
return html`
|
||||
<div class="centered-container">
|
||||
<div id="contacts-list">
|
||||
${this.state.nearbyUsers && this.state.nearbyUsers.length ? html`
|
||||
<h3>Nearby users</h3>
|
||||
${this.renderNearbyUsers()}
|
||||
<hr/><br/>
|
||||
`:''}
|
||||
<${ScrollViewport}>
|
||||
${keys.map(k => {
|
||||
return html`
|
||||
|
47
yarn.lock
47
yarn.lock
@ -5404,6 +5404,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a"
|
||||
integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==
|
||||
|
||||
growly@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
|
||||
integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=
|
||||
|
||||
gun@^0.2020.1232:
|
||||
version "0.2020.1232"
|
||||
resolved "https://registry.yarnpkg.com/gun/-/gun-0.2020.1232.tgz#3a75eba0c5f1ea3bd2e49ee5d8f02381e310c9d2"
|
||||
@ -6144,6 +6149,11 @@ is-directory@^0.3.1:
|
||||
resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1"
|
||||
integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=
|
||||
|
||||
is-docker@^2.0.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
|
||||
integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==
|
||||
|
||||
is-extendable@^0.1.0, is-extendable@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89"
|
||||
@ -6355,6 +6365,13 @@ is-wsl@^1.1.0:
|
||||
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
|
||||
integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=
|
||||
|
||||
is-wsl@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271"
|
||||
integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==
|
||||
dependencies:
|
||||
is-docker "^2.0.0"
|
||||
|
||||
is-yarn-global@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/is-yarn-global/-/is-yarn-global-0.3.0.tgz#d502d3382590ea3004893746754c89139973e232"
|
||||
@ -7975,6 +7992,18 @@ node-modules-regexp@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40"
|
||||
integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=
|
||||
|
||||
node-notifier@9.0.1:
|
||||
version "9.0.1"
|
||||
resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-9.0.1.tgz#cea837f4c5e733936c7b9005e6545cea825d1af4"
|
||||
integrity sha512-fPNFIp2hF/Dq7qLDzSg4vZ0J4e9v60gJR+Qx7RbjbWqzPDdEqeVpEx5CFeDAELIl+A/woaaNn1fQ5nEVerMxJg==
|
||||
dependencies:
|
||||
growly "^1.3.0"
|
||||
is-wsl "^2.2.0"
|
||||
semver "^7.3.2"
|
||||
shellwords "^0.1.1"
|
||||
uuid "^8.3.0"
|
||||
which "^2.0.2"
|
||||
|
||||
node-releases@^1.1.73:
|
||||
version "1.1.74"
|
||||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.74.tgz#e5866488080ebaa70a93b91144ccde06f3c3463e"
|
||||
@ -10305,6 +10334,11 @@ shebang-regex@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
|
||||
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
|
||||
|
||||
shellwords@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
|
||||
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
|
||||
|
||||
side-channel@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
|
||||
@ -11673,6 +11707,11 @@ uuid@^3.3.2, uuid@^3.4.0:
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||
|
||||
uuid@^8.3.0:
|
||||
version "8.3.2"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
|
||||
v8-compile-cache@^2.0.3:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"
|
||||
@ -11809,6 +11848,14 @@ webidl-conversions@^6.1.0:
|
||||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514"
|
||||
integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==
|
||||
|
||||
webpack-build-notifier@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/webpack-build-notifier/-/webpack-build-notifier-2.3.0.tgz#cb314fbe85b2684e00443b465c08026e812b83f5"
|
||||
integrity sha512-+/s6GrvSRwP0CHqHOqZcta7EcqjL1MUR9KmBSlkJj6xJVZtFB/z68CTeLPrHnMED/umlXN9hcFV8wmGjeI/K2A==
|
||||
dependencies:
|
||||
node-notifier "9.0.1"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
webpack-bundle-analyzer@^4.4.2:
|
||||
version "4.4.2"
|
||||
resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.4.2.tgz#39898cf6200178240910d629705f0f3493f7d666"
|
||||
|
Loading…
Reference in New Issue
Block a user