Compare commits

...

18 Commits

Author SHA1 Message Date
Christian Kellner
2fd03bce79 improve docker build 2025-05-26 13:20:12 +02:00
Christian Kellner
78a122b3ea improve docker build 2025-05-26 12:07:22 +02:00
Christian Kellner
918c6ade36 next version 2025-05-26 11:57:54 +02:00
Christian Kellner
9fac1aee06 adding forgotten yarn.lock 2025-05-26 11:34:05 +02:00
Christian Kellner
f9c6b10976 fixing tests 2025-05-26 10:43:13 +02:00
Christian Kellner
d624e70732 adding lock 2025-05-16 15:10:06 +02:00
Christian Kellner
0cbfaaf092 revert to use yarn 2025-05-16 15:03:28 +02:00
Christian Kellner
c6fb856cb6 fix docker build 2025-05-16 14:26:39 +02:00
Christian Kellner
6fe0a9dc3c fix pnpm version 2025-05-16 14:23:01 +02:00
Christian Kellner
5d52e4152d fix pnpm version 2025-05-16 14:21:29 +02:00
Christian Kellner
a8e5f8b524 improve test and docker runner 2025-05-16 14:19:20 +02:00
Christian Kellner
4b45ff4430 improve readme 2025-05-16 14:06:02 +02:00
Christian Kellner
db6211777b improve test and docker runner 2025-05-16 14:04:55 +02:00
Christian Kellner
21dd48527c fixing test runner 2025-05-16 14:00:17 +02:00
Christian Kellner
b0d494eed6 ading lock 2025-05-16 13:58:45 +02:00
Christian Kellner
9efb3e4b94 tagging new version, switching to node 22 2025-05-16 13:45:29 +02:00
Christian Kellner
683c47f61c tagging new version, switching to node 22 2025-05-16 13:44:45 +02:00
Christian Kellner
b3c11320d4 switching to pnpm for faster build 2025-05-16 13:38:25 +02:00
10 changed files with 1182 additions and 2654 deletions

View File

@@ -1,7 +1,6 @@
node_modules/ node_modules/
npm-debug.log npm-debug.log
test/ test/
conf/
db/ db/
.git/ .git/
.github/ .github/

View File

@@ -18,6 +18,10 @@ jobs:
contents: read contents: read
packages: write packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -51,3 +55,5 @@ jobs:
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@@ -113,7 +113,7 @@ I'm using Eslint to maintain quote style and quality. Do not skip it...
##### To do before merging: ##### To do before merging:
- executed tests? (`yarn run test`) - executed tests? (`pnpm test`)
- sure the changes are useful for everybody? Or is it maybe a custom modification just for your case? - sure the changes are useful for everybody? Or is it maybe a custom modification just for your case?
_Thanks!_ :heart: _Thanks!_ :heart:

View File

@@ -1,28 +1,35 @@
FROM node:20 FROM node:22-slim
WORKDIR /fredy WORKDIR /fredy
COPY . /fredy # Install Chromium without extra recommended packages and clean apt cache
RUN apt-get update \
RUN apt-get update && apt-get install -y chromium && apt-get install -y --no-install-recommends chromium \
&& rm -rf /var/lib/apt/lists/*
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
# Timeout fix für yarn hinzugefügt # Copy lockfiles first to leverage cache for dependencies
RUN yarn config set network-timeout 600000 COPY package.json yarn.lock ./
RUN yarn install # Set Yarn timeout, install dependencies and PM2 globally
RUN yarn config set network-timeout 600000 \
RUN yarn global add pm2 && yarn install --frozen-lockfile \
&& yarn global add pm2
# Copy application source and build production assets
COPY . ./
RUN yarn run prod RUN yarn run prod
RUN mkdir /db /conf && \ # Prepare runtime directories and symlinks for data and config
chown 1000:1000 /db /conf && \ RUN mkdir -p /db /conf \
chmod 777 -R /db/ && \ && chown 1000:1000 /db /conf \
ln -s /db /fredy/db && ln -s /conf /fredy/conf && chmod 777 /db /conf \
&& ln -s /db /fredy/db \
&& ln -s /conf /fredy/conf
EXPOSE 9998 EXPOSE 9998
CMD pm2-runtime index.js # Start application using PM2 runtime
CMD ["pm2-runtime", "index.js"]

View File

@@ -23,7 +23,7 @@ const config = {
id: 'a@href', id: 'a@href',
price: 'div[data-testid="cardmfe-price-testid"] | removeNewline | trim', price: 'div[data-testid="cardmfe-price-testid"] | removeNewline | trim',
size: 'div[data-testid="cardmfe-keyfacts-testid"] | removeNewline | trim', size: 'div[data-testid="cardmfe-keyfacts-testid"] | removeNewline | trim',
title: '.css-jv3zx6', title: 'div[data-testid="cardmfe-description-box-text-test-id"] > div:nth-of-type(2)',
link: 'a@href', link: 'a@href',
address: 'div[data-testid="cardmfe-description-box-address"] | removeNewline | trim', address: 'div[data-testid="cardmfe-description-box-address"] | removeNewline | trim',
}, },

View File

@@ -79,7 +79,7 @@ const PARAM_NAME_MAP = {
geocoordinates: 'geocoordinates', geocoordinates: 'geocoordinates',
shape: 'shape', shape: 'shape',
sorting: 'sorting', sorting: 'sorting',
newbuilding: 'newbuilding' newbuilding: 'newbuilding',
}; };
const EQUIPMENT_MAP = { const EQUIPMENT_MAP = {
@@ -90,7 +90,7 @@ const EQUIPMENT_MAP = {
garden: 'garden', garden: 'garden',
guesttoilet: 'guestToilet', guesttoilet: 'guestToilet',
balcony: 'balcony', balcony: 'balcony',
handicappedaccessible: 'handicappedAccessible' handicappedaccessible: 'handicappedAccessible',
}; };
const REAL_ESTATE_TYPE = { const REAL_ESTATE_TYPE = {
@@ -120,7 +120,7 @@ const WEB_PATH_TO_APARTMENT_EQUIPMENT_MAP = {
'wohnung-mit-keller-mieten': { equipment: ['cellar'] }, 'wohnung-mit-keller-mieten': { equipment: ['cellar'] },
// Category "Merkmale" // Category "Merkmale"
'neubauwohnung-mieten': { newbuilding: true }, 'neubauwohnung-mieten': { newbuilding: true },
'barrierefreie-wohnung-mieten': { equipment: ['handicappedaccessible'] } 'barrierefreie-wohnung-mieten': { equipment: ['handicappedaccessible'] },
}; };
export function convertWebToMobile(webUrl) { export function convertWebToMobile(webUrl) {
@@ -165,7 +165,7 @@ export function convertWebToMobile(webUrl) {
searchType: isRadius ? 'radius' : 'region', searchType: isRadius ? 'radius' : 'region',
realestatetype: realType, realestatetype: realType,
...(isRadius ? {} : { geocodes }), ...(isRadius ? {} : { geocodes }),
...additionalParamsFromWebPath ...additionalParamsFromWebPath,
}; };
if (webParams.geocoordinates) { if (webParams.geocoordinates) {
@@ -176,7 +176,10 @@ export function convertWebToMobile(webUrl) {
if (key === 'equipment') { if (key === 'equipment') {
const items = [].concat(val).flatMap((v) => `${v}`.split(',')); const items = [].concat(val).flatMap((v) => `${v}`.split(','));
const currentEquipmentParams = mobileParams[PARAM_NAME_MAP[key]]; const currentEquipmentParams = mobileParams[PARAM_NAME_MAP[key]];
mobileParams[PARAM_NAME_MAP[key]] = [...currentEquipmentParams ?? [], ...items.map((item) => EQUIPMENT_MAP[item.toLowerCase()]).filter(Boolean)]; mobileParams[PARAM_NAME_MAP[key]] = [
...(currentEquipmentParams ?? []),
...items.map((item) => EQUIPMENT_MAP[item.toLowerCase()]).filter(Boolean),
];
} else { } else {
mobileParams[PARAM_NAME_MAP[key]] = val; mobileParams[PARAM_NAME_MAP[key]] = val;
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "fredy", "name": "fredy",
"version": "11.2.1", "version": "11.2.2",
"description": "[F]ind [R]eal [E]states [d]amn eas[y].", "description": "[F]ind [R]eal [E]states [d]amn eas[y].",
"scripts": { "scripts": {
"start": "node prod.js", "start": "node prod.js",

View File

@@ -37,7 +37,7 @@
"enabled": true "enabled": true
}, },
"wgGesucht": { "wgGesucht": {
"url": "https://www.wg-gesucht.de/wg-zimmer-in-Duesseldorf.30.0.1.0.html?offer_filter=1&noDeact=1&city_id=30&category=0&rent_type=0&rMax=5000", "url": "https://www.wg-gesucht.de/wg-zimmer-in-Duesseldorf.30.0.1.0.html",
"enabled": true "enabled": true
} }
} }

View File

@@ -18,8 +18,7 @@ describe('#immoscout-mobile URL conversion', () => {
// Test URL conversion of web-only SEO path // Test URL conversion of web-only SEO path
it('should convert a SEO web path to the correct query params', () => { it('should convert a SEO web path to the correct query params', () => {
const webUrl = const webUrl = 'https://www.immobilienscout24.de/Suche/de/berlin/berlin/wohnung-mit-balkon-mieten?equipment=garden';
'https://www.immobilienscout24.de/Suche/de/berlin/berlin/wohnung-mit-balkon-mieten?equipment=garden';
const converted = convertWebToMobile(webUrl); const converted = convertWebToMobile(webUrl);
const queryParams = new URL(converted).searchParams; const queryParams = new URL(converted).searchParams;

3768
yarn.lock

File diff suppressed because it is too large Load Diff