Skip to content

Commit 9d3fe9e

Browse files
authored
Merge pull request #1857 from session-foundation/dev
Session 1.17.11
2 parents 46e3fd1 + d912430 commit 9d3fe9e

File tree

17 files changed

+297
-88
lines changed

17 files changed

+297
-88
lines changed

.github/workflows/build-binaries.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ jobs:
167167
if: ${{ matrix.is_qa == true }}
168168
uses: ./actions/sed_for_qa
169169

170+
- name: Enforce static builds for libsession-util-nodejs
171+
uses: ./actions/enforce_static_builds
172+
170173
- name: Build
171174
run: pnpm run build
172175

@@ -339,6 +342,9 @@ jobs:
339342
with:
340343
cache_suffix: ${{ matrix.cache_suffix }}
341344

345+
- name: Enforce static builds for libsession-util-nodejs
346+
uses: ./actions/enforce_static_builds
347+
342348
- name: Build
343349
run: pnpm run build
344350

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Update Localization Submodule
2+
3+
on:
4+
workflow_dispatch: # Manual trigger
5+
schedule:
6+
- cron: "20 10 * * *" # Runs at 10:20 am everyday
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
update-localization:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Update submodule to latest main
24+
run: |
25+
cd ts/localization
26+
git fetch origin main
27+
git checkout FETCH_HEAD
28+
cd ../..
29+
30+
- name: Check for changes
31+
id: changes
32+
run: |
33+
if git diff --quiet; then
34+
echo "has_changes=false" >> $GITHUB_OUTPUT
35+
echo "No submodule changes detected"
36+
else
37+
echo "has_changes=true" >> $GITHUB_OUTPUT
38+
echo "Submodule changes detected"
39+
fi
40+
41+
- name: Create Pull Request
42+
if: steps.changes.outputs.has_changes == 'true'
43+
uses: peter-evans/create-pull-request@v6
44+
with:
45+
commit-message: "chore: update localization submodule"
46+
branch: update-localization
47+
delete-branch: true
48+
title: "chore: Update localization submodule"
49+
body: |
50+
## Changes
51+
- Updated `session-localization` submodule to latest `feature/update-crowdin-translations`
52+
53+
This updates the translations with the latest changes from Crowdin.
54+
55+
Auto-generated by workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'Enforce static builds link only to system libs'
2+
description: 'Enforce that the libsession-util-nodejs.node is only linking to system libraries'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Check static library linkage
8+
shell: bash
9+
run: |
10+
if [ "$RUNNER_OS" == "Windows" ]; then
11+
echo "Skipping library check on Windows"
12+
exit 0
13+
fi
14+
15+
if ! find . -name 'libsession_util_nodejs.node' | grep -q .; then
16+
echo -e "\nNo libsession_util_nodejs.node file found\n"
17+
exit 1
18+
fi
19+
20+
echo "Found files:"
21+
find . -name 'libsession_util_nodejs.node' | while IFS= read -r f; do
22+
echo " $f"
23+
done
24+
25+
bad=
26+
27+
while IFS= read -r node_file; do
28+
echo "--- Checking: $node_file ---"
29+
if [ "$RUNNER_OS" == "macOS" ]; then
30+
otool -L "$node_file"
31+
if otool -L "$node_file" | \
32+
grep -Ev '\.node:|@rpath/libsession_util_nodejs|/usr/lib/libc\+\+|/usr/lib/libSystem'; then
33+
bad=1
34+
fi
35+
elif [ "$RUNNER_OS" == "Linux" ]; then
36+
ldd "$node_file"
37+
if ldd "$node_file" | grep -Ev '(linux-vdso\.so\.[0-9]+|ld-linux-(x86-64|armhf|aarch64)\.so\.[0-9]+|lib(stdc\+\+|gcc_s|c|m)\.so\.[0-9]+)'; then
38+
bad=1
39+
fi
40+
else
41+
echo -e "\nDon't know how to check linked libs on $RUNNER_OS\n"
42+
exit 1
43+
fi
44+
done < <(find . -name 'libsession_util_nodejs.node')
45+
46+
if [ -n "$bad" ]; then
47+
echo -e "\nlibsession-util-nodejs links to unexpected libraries\n"
48+
exit 1
49+
fi
50+
51+
echo -e "\nNo unexpected linked libraries found\n"

dynamic_assets

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "session-desktop",
55
"productName": "Session",
66
"description": "Private messaging from your desktop",
7-
"version": "1.17.10",
7+
"version": "1.17.11",
88
"license": "GPL-3.0",
99
"author": {
1010
"name": "Session Foundation",
@@ -95,7 +95,7 @@
9595
"framer-motion": "^12.5.0",
9696
"fs-extra": "11.3.0",
9797
"image-type": "^4.1.0",
98-
"libsession_util_nodejs": "https://github.com/session-foundation/libsession-util-nodejs/releases/download/v0.6.11/libsession_util_nodejs-v0.6.11.tar.gz",
98+
"libsession_util_nodejs": "https://github.com/session-foundation/libsession-util-nodejs/releases/download/v0.6.12/libsession_util_nodejs-v0.6.12.tar.gz",
9999
"libsodium-wrappers-sumo": "^0.7.15",
100100
"linkify-it": "^5.0.0",
101101
"lodash": "^4.17.21",

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/components/SessionPopover.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import styled from 'styled-components';
22
import { type ReactNode, useMemo, useRef } from 'react';
33
import { getFeatureFlagMemo } from '../state/ducks/types/releasedFeaturesReduxTypes';
44
import { clampNumber } from '../util/maths';
5-
import { defaultTriggerPos, PopoverTriggerPosition } from './SessionTooltip';
5+
import { PopoverTriggerPosition } from './SessionTooltip';
66

77
const TIP_LENGTH = 18;
88
const VIEWPORT_MARGIN = 4;
@@ -95,7 +95,7 @@ const StyledPopover = styled.div<{
9595
export type PopoverProps = {
9696
children: ReactNode;
9797
pointerOffset?: number;
98-
triggerPosition: PopoverTriggerPosition;
98+
triggerPosition: PopoverTriggerPosition | null;
9999
open: boolean;
100100
loading?: boolean;
101101
maxWidth?: string;
@@ -124,7 +124,7 @@ export const SessionPopoverContent = (props: PopoverProps) => {
124124
loading,
125125
maxWidth,
126126
onClick,
127-
triggerPosition = defaultTriggerPos,
127+
triggerPosition,
128128
isTooltip,
129129
contentMargin = 0,
130130
containerMarginTop = VIEWPORT_MARGIN,
@@ -146,8 +146,10 @@ export const SessionPopoverContent = (props: PopoverProps) => {
146146
const viewportWidth = window.innerWidth;
147147
const viewportHeight = window.innerHeight;
148148

149+
const show = open && !loading && !!triggerPosition;
150+
149151
const { x, y, pointerOffset, anchorX, finalVerticalPos, bounds } = useMemo(() => {
150-
if (!open || loading) {
152+
if (!show) {
151153
return {
152154
x: 0,
153155
y: 0,
@@ -217,15 +219,10 @@ export const SessionPopoverContent = (props: PopoverProps) => {
217219
bounds: { x1: minX, y1: minY, x2: maxX, y2: maxY },
218220
};
219221
}, [
220-
open,
221-
loading,
222+
show,
222223
contentWidth,
223224
isTooltip,
224-
triggerPosition.x,
225-
triggerPosition.y,
226-
triggerPosition.width,
227-
triggerPosition.height,
228-
triggerPosition.offsetX,
225+
triggerPosition,
229226
horizontalPosition,
230227
viewportWidth,
231228
verticalPosition,
@@ -244,7 +241,7 @@ export const SessionPopoverContent = (props: PopoverProps) => {
244241
<>
245242
<StyledPopover
246243
ref={ref}
247-
$readyToShow={open && !loading}
244+
$readyToShow={show}
248245
onClick={onClick}
249246
x={x}
250247
y={y}
@@ -257,7 +254,7 @@ export const SessionPopoverContent = (props: PopoverProps) => {
257254
>
258255
{children}
259256
</StyledPopover>
260-
{showPopoverAnchors && open ? (
257+
{showPopoverAnchors && show ? (
261258
// NOTE: these are only rendered when the debug option is enabled
262259
<>
263260
<StyledCoordinateRectangleMarker title="allowedArea" $bounds={bounds} />

ts/components/SessionTooltip.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,12 @@ export const getTriggerPositionFromId = (id: string): PopoverTriggerPosition =>
6666
return getTriggerPositionFromBoundingClientRect(el.getBoundingClientRect());
6767
};
6868

69-
export const useTriggerPosition = (ref: RefObject<HTMLElement | null>): PopoverTriggerPosition => {
69+
// Returns null if the ref is null
70+
export const useTriggerPosition = (
71+
ref: RefObject<HTMLElement | null>
72+
): PopoverTriggerPosition | null => {
7073
if (!ref.current) {
71-
return defaultTriggerPos;
74+
return null;
7275
}
7376
return getTriggerPositionFromBoundingClientRect(ref.current.getBoundingClientRect());
7477
};

ts/components/conversation/SessionEmojiPanelPopover.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RefObject } from 'react';
2-
import { useTriggerPosition } from '../SessionTooltip';
2+
import { type PopoverTriggerPosition } from '../SessionTooltip';
33
import { SessionEmojiPanel } from './SessionEmojiPanel';
44
import { SessionPopoverContent } from '../SessionPopover';
55
import { FixedBaseEmoji } from '../../types/Reaction';
@@ -9,30 +9,30 @@ const EMOJI_PANEL_WIDTH_PX = 354;
99
const EMOJI_PANEL_HEIGHT_PX = 435;
1010

1111
export function SessionEmojiPanelPopover({
12-
triggerRef,
12+
triggerPos,
1313
emojiPanelRef,
1414
onEmojiClicked,
1515
open,
1616
onClose,
1717
}: {
18-
triggerRef: RefObject<HTMLButtonElement | null>;
18+
triggerPos: PopoverTriggerPosition | null;
1919
open: boolean;
2020
emojiPanelRef: RefObject<HTMLDivElement | null>;
2121
onEmojiClicked: (emoji: FixedBaseEmoji) => void;
2222
onClose: () => void;
2323
}) {
24-
const triggerPos = useTriggerPosition(triggerRef);
24+
const _open = open && !!triggerPos;
2525
return (
2626
<SessionPopoverContent
2727
triggerPosition={triggerPos}
28-
open={open}
28+
open={_open}
2929
isTooltip={false}
3030
verticalPosition="bottom"
3131
horizontalPosition="center"
3232
fallbackContentWidth={EMOJI_PANEL_WIDTH_PX}
3333
fallbackContentHeight={EMOJI_PANEL_HEIGHT_PX}
3434
>
35-
{open ? (
35+
{_open ? (
3636
<SessionEmojiPanel
3737
ref={emojiPanelRef}
3838
show={true}

ts/components/conversation/SessionEmojiReactBarPopover.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useRef, useState } from 'react';
22
import useClickAway from 'react-use/lib/useClickAway';
3-
import type { PopoverTriggerPosition } from '../SessionTooltip';
3+
import { useTriggerPosition, type PopoverTriggerPosition } from '../SessionTooltip';
44
import { SessionPopoverContent } from '../SessionPopover';
55
import { MessageReactBar } from './message/message-content/MessageReactBar';
66
import { THEME_GLOBALS } from '../../themes/globals';
@@ -22,14 +22,14 @@ export function SessionEmojiReactBarPopover({
2222
onClickAwayFromReactionBar: () => void;
2323
}) {
2424
const emojiPanelTriggerRef = useRef<HTMLButtonElement>(null);
25+
const emojiPanelTriggerPos = useTriggerPosition(emojiPanelTriggerRef);
2526
const emojiPanelRef = useRef<HTMLDivElement>(null);
2627
const emojiReactionBarRef = useRef<HTMLDivElement>(null);
2728
const [showEmojiPanel, setShowEmojiPanel] = useState<boolean>(false);
2829
const { reactToMessage } = useMessageInteractions(messageId);
2930
const focusedMessageId = useFocusedMessageId();
3031

3132
const closeEmojiPanel = () => {
32-
closeContextMenus();
3333
setShowEmojiPanel(false);
3434
};
3535

@@ -66,7 +66,7 @@ export function SessionEmojiReactBarPopover({
6666
<>
6767
<SessionEmojiPanelPopover
6868
emojiPanelRef={emojiPanelRef}
69-
triggerRef={emojiPanelTriggerRef}
69+
triggerPos={emojiPanelTriggerPos}
7070
// eslint-disable-next-line @typescript-eslint/no-misused-promises
7171
onEmojiClicked={onEmojiClick}
7272
open={showEmojiPanel}

0 commit comments

Comments
 (0)