Skip to content

Commit

Permalink
Merge pull request #2102 from holium/master
Browse files Browse the repository at this point in the history
release-v0.19.1
  • Loading branch information
gdbroman authored Nov 20, 2023
2 parents 88471c2 + 1c14f4d commit e576aef
Show file tree
Hide file tree
Showing 27 changed files with 216 additions and 206 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/cypress.yml

This file was deleted.

2 changes: 1 addition & 1 deletion app/.holium/configs/webpack.config.renderer.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const configuration: webpack.Configuration = {
'https://56fbf5e600db48cf8a785931be1ca5e4@o1327359.ingest.sentry.io/4504310987358208',
AMPLITUDE_API_KEY: 'd6d123a2a660806abcc6b1845c475f2f',
AMPLITUDE_API_KEY_DEV: '68e00eca14dda372e15a8aadaa0b37ac',
API_URL: 'https://backend-server.third.earth',
API_URL: 'https://backend-server.holium.network',
JOIN_API_URL: 'https://join.holium.com',
API_HEADERS_CLIENT_ID: '5',
API_HEADERS_VERSION: '2',
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"detect-port": "^1.3.0",
"dotenv": "^16.0.3",
"dotenv-webpack": "^8.0.1",
"electron": "^23.0.0",
"electron": "^23.3.13",
"electron-builder": "^23.3.3",
"electron-notarize": "^1.2.1",
"electronmon": "^2.0.2",
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/helpers/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const registerListeners = (mainWindow: BrowserWindow) => {
// Preserve fullscreen state.
const isFullScreen = mainWindow.isFullScreen();
if (isFullScreen) {
fullScreenWindow(mainWindow);
fullScreenWindow(mainWindow, null);
}
});
};
Expand Down
27 changes: 19 additions & 8 deletions app/src/main/helpers/fullscreen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BrowserWindow, ipcMain, screen } from 'electron';

import { RealmService } from '../../os/realm.service';
import { isMacWithCameraNotch } from './env';

// Get the menu bar of new macs with notch.
Expand Down Expand Up @@ -50,19 +51,25 @@ const getFullScreenBounds = () => {
return fullScreenBounds;
};

export const fullScreenWindow = (window: BrowserWindow) => {
export const fullScreenWindow = (
window: BrowserWindow,
realmService: RealmService | null
) => {
const fullScreenBounds = getFullScreenBounds();
window.setBounds(fullScreenBounds);
window.setFullScreen(true);

const hasCameraNotch = isMacWithCameraNotch();
if (hasCameraNotch) window.setSimpleFullScreen(true);
else window.setFullScreen(true);
window.webContents.send('set-fullscreen', true);
window.webContents.send('use-custom-titlebar', hasCameraNotch);
realmService?.setLastWindowBounds(fullScreenBounds);
};

export const windowWindow = (window: BrowserWindow) => {
export const windowWindow = (
window: BrowserWindow,
realmService: RealmService | null
) => {
const windowedBounds = getWindowedBounds();

window.setFullScreen(false);
Expand All @@ -72,25 +79,29 @@ export const windowWindow = (window: BrowserWindow) => {
window.setBounds(windowedBounds);
window.webContents.send('set-fullscreen', false);
window.webContents.send('use-custom-titlebar', hasCameraNotch);
realmService?.setLastWindowBounds(windowedBounds);
};

let rs: any;
export const toggleFullScreen = (window: BrowserWindow) => {
const hasCameraNotch = isMacWithCameraNotch();

if (
window.isFullScreen() ||
(hasCameraNotch && window.isSimpleFullScreen())
) {
windowWindow(window);
windowWindow(window, rs);
} else {
fullScreenWindow(window);
fullScreenWindow(window, rs);
}
};

const registerListeners = (
mainWindow: BrowserWindow,
mouseWindow: BrowserWindow
mouseWindow: BrowserWindow,
realmService: RealmService | null
) => {
rs = realmService;
mainWindow.on('enter-full-screen', () => {
if (!mainWindow) return;
if (mainWindow.isDestroyed()) return;
Expand Down Expand Up @@ -123,9 +134,9 @@ const registerListeners = (

ipcMain.handle('set-fullscreen', (_, shouldFullScreen) => {
if (shouldFullScreen) {
fullScreenWindow(mainWindow);
fullScreenWindow(mainWindow, realmService);
} else {
windowWindow(mainWindow);
windowWindow(mainWindow, realmService);
}
});

Expand Down
9 changes: 6 additions & 3 deletions app/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const bootRealm = () => {
}
});

mouseOverlayWindow = createMouseOverlayWindow(realmWindow);
mouseOverlayWindow = createMouseOverlayWindow(realmWindow, realmService);

menuBuilder = null;

Expand Down Expand Up @@ -136,15 +136,18 @@ export const bootStandaloneChat = () => {
if (realmWindow && !realmWindow.isDestroyed()) {
// We need to window the window before closing it, otherwise
// the Mac menubar isn't reliably restored from simple fullscreen.
windowWindow(realmWindow);
windowWindow(realmWindow, null);
realmWindow.destroy();
}

realmWindow = null;

setRealmCursor(false);
standaloneChatWindow = createStandaloneChatWindow();
mouseOverlayWindow = createMouseOverlayWindow(standaloneChatWindow);
mouseOverlayWindow = createMouseOverlayWindow(
standaloneChatWindow,
realmService
);

menuBuilder = null;

Expand Down
16 changes: 12 additions & 4 deletions app/src/main/windows.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BrowserWindow, shell } from 'electron';

import { RealmService } from '../os/realm.service';
import { BrowserHelper } from './helpers/browser';
import { CursorSettingsHelper } from './helpers/cursorSettings';
import { DeepLinkHelper } from './helpers/deepLink';
Expand Down Expand Up @@ -81,7 +82,7 @@ export const createRealmWindow = (
initialBounds === undefined) &&
!hasBeenExpanded(newRealmWindow)
) {
fullScreenWindow(newRealmWindow);
fullScreenWindow(newRealmWindow, null);
} else {
if (initialBounds !== undefined) {
newRealmWindow.setBounds(initialBounds);
Expand All @@ -98,7 +99,10 @@ export const createRealmWindow = (
return newRealmWindow;
};

export const createMouseOverlayWindow = (parentWindow: BrowserWindow) => {
export const createMouseOverlayWindow = (
parentWindow: BrowserWindow,
realmService: RealmService | null
) => {
// Create a window covering the whole main window.
const defaultMouseWindowOptions: Electron.BrowserWindowConstructorOptions = {
show: false,
Expand Down Expand Up @@ -131,7 +135,11 @@ export const createMouseOverlayWindow = (parentWindow: BrowserWindow) => {
newMouseWindow.setIgnoreMouseEvents(true);
newMouseWindow.loadURL(resolveHtmlPath('mouse.html'));

FullScreenHelper.registerListeners(parentWindow, newMouseWindow);
FullScreenHelper.registerListeners(
parentWindow,
newMouseWindow,
realmService
);
CursorSettingsHelper.registerListeners(parentWindow, newMouseWindow);
MouseEventsHelper.registerListeners(parentWindow, newMouseWindow);

Expand Down Expand Up @@ -200,7 +208,7 @@ export const createStandaloneChatWindow = () => {

newStandaloneChatWindow.on('ready-to-show', () => {
if (!hasBeenExpanded(newStandaloneChatWindow)) {
windowWindow(newStandaloneChatWindow);
windowWindow(newStandaloneChatWindow, null);
}

newStandaloneChatWindow.show();
Expand Down
4 changes: 3 additions & 1 deletion app/src/os/realm.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ export class RealmService extends AbstractService<RealmUpdateTypes> {

this._sendAuthenticated(patp, credentials.url, credentials.cookie ?? '');
const updatedPassport = await this.services.ship?.getOurPassport();
this.services.auth.setPassport(patp, updatedPassport);
if (updatedPassport) {
this.services.auth.setPassport(patp, updatedPassport);
}
}
return isAuthenticated;
}
Expand Down
1 change: 1 addition & 0 deletions app/src/os/services/ship/chat/chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export class ChatService extends AbstractService<ChatUpdateTypes> {
peers,
invites: 'anyone',
'max-expires-at-duration': null,
'peers-get-backlog': true,
},
},
};
Expand Down
44 changes: 34 additions & 10 deletions app/src/os/services/ship/friends/friends.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,49 @@ export class FriendsService extends AbstractDataAccess<Friend, any> {
insertMany(friends);
}

async fetchOne(patp: string) {
async fetchOur() {
const response = await APIConnection.getInstance().conduit.scry({
app: 'friends',
path: `/contact/${patp}`,
app: 'passport',
path: '/our-passport',
});

return {
...response,
color: response.color ? cleanNounColor(response.color) : '#000',
avatar: response.contact.avatar ? response.contact.avatar.img : null,
cover: response.cover,
bio: response.contact.bio,
nickname: response.contact['display-name'],
color: response.contact.color || '#000000',
};
}

private async _fetchFriends() {
// Get last timestamp
const response = await APIConnection.getInstance().conduit.scry({
app: 'friends',
path: '/all',
const contacts = await APIConnection.getInstance().conduit.scry({
app: 'passport',
path: '/contacts',
});
return response?.friends;
const friends = await APIConnection.getInstance().conduit.scry({
app: 'passport',
path: '/friends',
});
const result: any = {};
for (const c of contacts) {
const isfriend = !!friends.find(
(f: any) => f.status === 'friend' && f.ship === c.ship
);
result[c.ship] = {
status: isfriend ? 'fren' : 'contact',
tags: [],
pinned: false,
contactInfo: {
avatar: c.avatar ? c.avatar.img : null,
cover: null,
bio: c.bio,
nickname: c['display-name'],
color: c.color || '#000000',
},
};
}
return result;
}

public async getFriends() {
Expand Down
8 changes: 3 additions & 5 deletions app/src/os/services/ship/ship.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class ShipService extends AbstractService<any> {
}

public async getOurPassport() {
return await this.services?.friends.fetchOne(this.patp);
return await this.services?.friends.fetchOur();
}

public updateCookie(cookie: string) {
Expand Down Expand Up @@ -324,12 +324,10 @@ export class ShipService extends AbstractService<any> {

// a little shim to handle people who accidentally included their bucket at the front of the credentials.endpoint
let endp = response.credentials.endpoint;
endp = endp.replace('https://', '');
if (endp.split('.')[0] === response.configuration.currentBucket) {
endp = endp.split('.').slice(1).join('.');
}

endp = endp.replace('https://', '');

const client = new S3Client({
endpoint: response.credentials.endpoint.includes('https://')
? response.credentials.endpoint
Expand Down Expand Up @@ -410,7 +408,7 @@ export class ShipService extends AbstractService<any> {

getPassport() {
if (!this.services) return;
return this.services.friends.fetchOne(this.patp);
return this.services.friends.fetchOur();
}

updatePassport(
Expand Down
6 changes: 0 additions & 6 deletions app/src/renderer/apps/Rooms/components/rooms.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ const contacts: any = {
avatar:
'https://lomder-librun.sfo3.digitaloceanspaces.com/Images/~fasnut-famden/1683832836-fasnut-famden%20light%20blue%20green.jpg',
},
'~lopsyp-doztun': {
color: '#129131',
nickname: 'Gus',
avatar:
'https://rindux-mocrux.s31.third.earth/~lopsyp-doztun/1683061010-boom.jpeg',
},
'~hostyv': {
color: '#785218',
nickname: 'hostyv',
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/apps/Spaces/SpaceRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const SpaceRowPresenter = (props: SpaceRowProps) => {
const contextMenuOptions = useMemo(() => {
const menu = [];
menu.push({
id: `space-row-${space.path}-btn-leave`,
id: `space-row-${space.path}-btn-copy`,
label: 'Copy link',
onClick: (evt: React.MouseEvent<HTMLDivElement>) => {
evt.stopPropagation();
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<base href="./" />
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="
connect-src 'self' https://*.stripe.com https://*.sentry.io https://*.amplitude.com ws://localhost:3001 ws://localhost:3030 http://localhost:8545 https://*.plymouth.network https://*.third.earth https://api.unsplash.com https://join.holium.com https://api.holium.live https://socket.holium.live wss://socket.holium.live wss://*.holium.live http://localhost:3000;
connect-src 'self' https://*.stripe.com https://*.sentry.io https://*.amplitude.com ws://localhost:3001 ws://localhost:3030 http://localhost:8545 https://*.plymouth.network https://*.holium.network https://api.unsplash.com https://join.holium.com https://api.holium.live https://socket.holium.live wss://socket.holium.live wss://*.holium.live http://localhost:3000;
frame-src 'self' https://*.stripe.com https://www.youtube.com https://open.spotify.com https://open.spotifycdn.com https://platform.twitter.com https://w.soundcloud.com;
script-src 'self' https://*.stripe.com https://www.youtube.com https://open.spotify.com https://open.spotifycdn.com https://platform.twitter.com;
script-src-elem 'self' https://*.stripe.com https://www.youtube.com https://open.spotify.com https://open.spotifycdn.com https://platform.twitter.com https://w.soundcloud.com;
Expand Down
27 changes: 11 additions & 16 deletions app/src/renderer/onboarding/steps/PassportStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,17 @@ export const PassportStep = ({ setStep }: StepProps) => {
const isHoliumHosted = serverType === 'hosted';

useEffect(() => {
const {
serverId,
serverCode,
serverUrl,
passwordHash,
clientSideEncryptionKey,
} = OnboardingStorage.get();

if (
!serverId ||
!serverCode ||
!serverUrl ||
!passwordHash ||
!clientSideEncryptionKey
) {
console.error('in bad state');
const { serverId, serverCode, serverUrl, passwordHash } =
OnboardingStorage.get();

if (!serverId || !serverCode || !serverUrl || !passwordHash) {
console.error(
'in bad state',
serverId,
serverCode,
serverUrl,
passwordHash
);
return;
}

Expand Down
Loading

0 comments on commit e576aef

Please sign in to comment.