Skip to content

Commit

Permalink
Merge Release 2.17.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sharunkumar committed Sep 12, 2024
2 parents a91e561 + fb05847 commit 6958c44
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 30 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
name: Run e2e tests
on:
push:
branches:
- main
pull_request:
branches:
- main
on: workflow_dispatch
jobs:
playwright:
name: Run Playwright tests
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.46.0-jammy
steps:
- uses: actions/checkout@v4
- run: corepack enable
Expand All @@ -23,5 +15,14 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Build project
run: pnpm build
- name: Run tests
run: env HOME=/root pnpm test:e2e
env:
VITE_FORCE_LEMMY_INSECURE: 1
VITE_CUSTOM_LEMMY_SERVERS: localhost:8536
VITE__TEST_MODE: 1
- name: Install Playwright dependencies
run: npx playwright install --with-deps
- name: Run Playwright tests
run: |
docker compose -f e2e/ci/docker-compose.yml up -d
sleep 10
pnpm run test:e2e
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "app.vger.voyager"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 260
versionName "2.17.0"
versionCode 261
versionName "2.17.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
46 changes: 46 additions & 0 deletions e2e/ci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Based on the nginx config made available by Lemmy developers.
# https://github.com/LemmyNet/lemmy

x-logging: &default-logging
driver: "json-file"
options:
max-size: "50m"
max-file: "4"

services:
proxy:
image: nginx:1-alpine
ports:
- "8536:8536"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro,Z
restart: unless-stopped
logging: *default-logging

lemmy:
image: dessalines/lemmy:0.19.5
platform: linux/x86_64
hostname: lemmy
restart: unless-stopped
environment:
- RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
- RUST_BACKTRACE=full
volumes:
- ./lemmy.hjson:/config/config.hjson:Z
depends_on:
- postgres
logging: *default-logging

postgres:
image: postgres
hostname: postgres
ports:
- "5433:5432"
environment:
- POSTGRES_USER=lemmy
- POSTGRES_PASSWORD=password
- POSTGRES_DB=lemmy
volumes:
- ./volumes/postgres:/var/lib/postgresql/data:Z
restart: unless-stopped
logging: *default-logging
20 changes: 20 additions & 0 deletions e2e/ci/lemmy.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
setup: {
admin_username: "voyager"
admin_password: "voyagerapp"
site_name: "voyager"
}

database: {
host: postgres
}

hostname: "localhost"
bind: "0.0.0.0"
port: 8536

pictrs: {
url: "http://pictrs:8080/"
image_mode: None
}
}
34 changes: 34 additions & 0 deletions e2e/ci/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Based on the nginx config made available by Lemmy developers.
# https://github.com/LemmyNet/lemmy

worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream lemmy {
# this needs to map to the lemmy (server) docker service hostname
server "lemmy:8536";
}

server {
listen 8536;
# change if needed, this is facing the public web
server_name localhost;
server_tokens off;

# backend
location ~ ^/(api|pictrs|feeds|nodeinfo|version|.well-known) {
proxy_pass "http://lemmy";
# proxy common stuff
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

# Send actual client IP upstream
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
4 changes: 2 additions & 2 deletions ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.17.0</string>
<string>2.17.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>260</string>
<string>261</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "voyager",
"description": "A progressive webapp Lemmy client",
"private": true,
"version": "2.17.0",
"version": "2.17.1",
"type": "module",
"packageManager": "pnpm@9.6.0+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions src/features/auth/authSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ export const instanceSelector = createSelector([handleSelector], (handle) => {
return getInstanceFromHandle(handle);
});

export const urlSelector = (state: RootState) =>
instanceSelector(state) ?? state.auth.connectedInstance;
export const urlSelector = (state: RootState) => {
if (import.meta.env.VITE__TEST_MODE) return state.auth.connectedInstance;

return instanceSelector(state) ?? state.auth.connectedInstance;
};

export const clientSelector = createSelector(
[urlSelector, jwtSelector],
Expand Down
5 changes: 5 additions & 0 deletions src/features/auth/authSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { getInstanceFromHandle, instanceSelector } from "./authSelectors";
import { receivedSite, resetSite } from "./siteSlice";
import { Register } from "lemmy-js-client";
import { setDefaultFeed } from "../settings/settingsSlice";
import { getDefaultServer } from "../../services/app";

const MULTI_ACCOUNT_STORAGE_NAME = "credentials";

Expand Down Expand Up @@ -142,6 +143,10 @@ export const authSlice = createSlice({
},

updateConnectedInstance(state, action: PayloadAction<string>) {
if (import.meta.env.VITE__TEST_MODE) {
state.connectedInstance = getDefaultServer();
return;
}
state.connectedInstance = action.payload;
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/features/comment/CommentLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import customRemarkGfm from "../shared/markdown/customRemarkGfm";
import { useAppSelector } from "../../store";
import { Text } from "mdast";
import { uniqBy } from "lodash";
import { isValidUrl } from "../../helpers/url";
import spoiler from "@aeharding/remark-lemmy-spoiler";
import { buildBaseLemmyUrl } from "../../services/lemmy";
import { defaultUrlTransform } from "react-markdown";

const Container = styled.div`
display: flex;
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function CommentLinks({ markdown }: CommentLinksProps) {
links = uniqBy(links, (l) => l.url);

// e.g. `http://127.0.0.1:8080”`
links = links.filter(({ url }) => isValidUrl(url));
links = links.filter(({ url }) => defaultUrlTransform(url));

// Max 4 links
links = links.slice(0, 4);
Expand Down
9 changes: 5 additions & 4 deletions src/features/inbox/inboxSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ export const totalUnreadSelector = (state: RootState) =>
state.inbox.counts.replies;

export const getInboxCounts =
() => async (dispatch: AppDispatch, getState: () => RootState) => {
(force = false) =>
async (dispatch: AppDispatch, getState: () => RootState) => {
const jwt = jwtSelector(getState());

if (!jwt) {
Expand All @@ -118,7 +119,7 @@ export const getInboxCounts =

const lastUpdatedCounts = getState().inbox.lastUpdatedCounts;

if (Date.now() - lastUpdatedCounts < 3_000) return;
if (!force && Date.now() - lastUpdatedCounts < 3_000) return;

const result = await clientSelector(getState()).getUnreadCount();

Expand Down Expand Up @@ -190,7 +191,7 @@ export const markAllRead =
await clientSelector(getState()).markAllAsRead();

dispatch(markAllReadInCache());
dispatch(getInboxCounts());
dispatch(getInboxCounts(true));
};

export const conversationsByPersonIdSelector = createSelector(
Expand Down Expand Up @@ -284,5 +285,5 @@ export const markRead =
throw error;
}

dispatch(getInboxCounts());
dispatch(getInboxCounts(true));
};
2 changes: 1 addition & 1 deletion src/features/inbox/messages/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default function Message({ message, first }: MessageProps) {
}

await dispatch(receivedMessages([response.private_message_view]));
await dispatch(getInboxCounts());
await dispatch(getInboxCounts(true));
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/features/shared/markdown/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const markdownCss = css`
@media (max-width: 700px) {
ul,
ol {
padding-left: 24px;
padding-left: 28px;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/features/shared/markdown/components/spoiler/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import store, { useAppDispatch } from "../../../../../store";
import { getSpoilerId, updateSpoilerState } from "./spoilerSlice";

const StyledIonAccordionGroup = styled(IonAccordionGroup)`
margin: 1em 0;
margin: 1em -12px;
`;

const HeaderItem = styled(IonItem)`
--padding-start: 0;
--padding-end: 0;
--padding-start: 12px;
--padding-end: 12px;
--inner-padding-end: 0;
--inner-padding-start: 0;
Expand All @@ -39,7 +39,7 @@ const StyledIonAccordion = styled(IonAccordion)`
background: none;
[slot="content"] {
padding: 1em 0;
padding: 1em 12px;
background: transparent;
Expand Down

0 comments on commit 6958c44

Please sign in to comment.