diff --git a/.babelrc b/.babelrc index b67a68f..103732f 100644 --- a/.babelrc +++ b/.babelrc @@ -3,9 +3,7 @@ [ "@babel/preset-env", { - "exclude": [ - "transform-regenerator" - ] + "exclude": ["transform-regenerator"] } ], [ @@ -15,4 +13,4 @@ } ] ] -} \ No newline at end of file +} diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..86c15b9 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +/ui/public +/db/ +/conf/ \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 2bbb296..6878f30 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -277,6 +277,5 @@ module.exports = { // Prevent passing of children as props // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md 'react/no-children-prop': 'warn', - }, }; diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8c84cd0..f1ce96a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,7 +4,6 @@ about: Create a report to help us improve title: '' labels: '' assignees: '' - --- **Describe the bug** @@ -12,6 +11,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7..2f28cea 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,7 +4,6 @@ about: Suggest an idea for this project title: '' labels: '' assignees: '' - --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/workflows/stales.yml b/.github/workflows/stales.yml index bb48b54..0399d78 100644 --- a/.github/workflows/stales.yml +++ b/.github/workflows/stales.yml @@ -2,7 +2,7 @@ name: Close stale issues and PRs on: schedule: - - cron: '0 0 * * *' # Daily + - cron: '0 0 * * *' # Daily jobs: stale: @@ -12,10 +12,10 @@ jobs: with: days-before-stale: 30 days-before-close: 7 - stale-issue-message: "This issue has been automatically marked as stale due to inactivity." - stale-pr-message: "This PR has been automatically marked as stale due to inactivity." - close-issue-message: "Closing this issue due to prolonged inactivity." - close-pr-message: "Closing this PR due to prolonged inactivity." - exempt-issue-labels: "keep-open" - exempt-pr-labels: "keep-open" - only: "pulls" \ No newline at end of file + stale-issue-message: 'This issue has been automatically marked as stale due to inactivity.' + stale-pr-message: 'This PR has been automatically marked as stale due to inactivity.' + close-issue-message: 'Closing this issue due to prolonged inactivity.' + close-pr-message: 'Closing this PR due to prolonged inactivity.' + exempt-issue-labels: 'keep-open' + exempt-pr-labels: 'keep-open' + only: 'pulls' diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..57e7bff --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +/ui/public +/db/ +/conf/ + +# TODO re-write from scratch or fix all html structure issues +/lib/notification/emailTemplate/template.hbs \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2785bd0..7fbc52e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,34 +1,42 @@ Newer release changelog see https://github.com/orangecoding/fredy/releases ------------- +--- ###### [V5.5.0] + - Upgrading dependencies - fixing provider -- allow multiple instances of 1 provider -- __BREAKING__: Minimum node version is now 16 +- allow multiple instances of 1 provider +- **BREAKING**: Minimum node version is now 16 ###### [V5.4.6] + - Adding Instana node.js monitoring -- +- + ###### [V5.4.5] -- Adding Instana node.js monitoring + +- Adding Instana node.js monitoring ###### [V5.4.4] + - Add support for Immo Südwest Presse (immo.swp.de) - Telegram: Use job name instead of ID and link in title - Fix race condition if user ID is in session but not in user store - Allow visiting the original provider URL ###### [V5.4.3] + - re-writing readme - improving docker build - using github's actions to build docker and test automatically ###### [V5.4.2] + - Fixing prod build ###### [V5.4.1] + - Upgrading dependencies - Provider urls are now automagically been changed to include the correct sort order for search results @@ -39,36 +47,44 @@ results, thus cannot report them. This release fixes it by adding the necessary ``` ###### [V5.3.0] + - Upgrading dependencies - It's now possible to send mails to multiple receiver using comma separation for MailJet & Sendgrid - Fixing Immowelt scraping ###### [V5.2.0] + - Upgrading dependencies - Adding new similarity check layer (Duplicates are being removed now) - Adding paging for search results ###### [V5.1.0] + - Upgrading dependencies - NodeJS 12.13 is now the minimum supported version - Adding general settings as new configuration page to ui - Adding new feature working hours ###### [V5.0.0] + - Upgrading dependencies - NodeJS 12 is now the minimum supported version ###### [V4.0.0] + Bringing back Immoscout :tada: ###### [V3.0.0] + This is basically a re-write, your old config file will not be compatible anymore. Please re-created your search jobs on the new ui and use the values from your previous config file if needed. + ``` - We're getting rid of manual config changes, Fredy, now ships with a UI so that it's easy for you to create and edit jobs ``` ###### [V2.0.0] + ``` - Fredy can now run multiple search job on one instance - Changed lot's of the structure of Fredy to make this happen diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f87c221..594b50e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,8 +2,8 @@ If you want to contribute, please make sure you've executed the tests. - ### How to write new provider? + - create the provider filer under `/lib/provider` - create a test under /test and make sure it is running successfully @@ -13,7 +13,7 @@ let appliedBlackList = []; //normalize incoming values function normalize(o) { const id = parseInt(o.id.substring(o.id.indexOf('_') + 1, o.id.length)); - + return Object.assign(o, { id }); } @@ -27,7 +27,7 @@ function applyBlacklist(o) { const config = { url: null, - //this is the container wrapping the search listings + //this is the container wrapping the search listings crawlContainer: '#result-list-stage .item', crawlFields: { id: '@id', @@ -49,7 +49,7 @@ exports.init = (sourceConfig, blacklist) => { appliedBlackList = blacklist || []; }; -//ths +//ths exports.metaInformation = { name: 'your provider name', baseUrl: 'https://www.yourprovider.de/', @@ -57,11 +57,10 @@ exports.metaInformation = { }; exports.config = config; - ``` - ### How to write new notification adapter? + - create the provider filer under `/lib/notification/adapter` - create a description of the provider under `/lib/notification/adapter/*.md`. Make sure the name of the md file is equal to the notification adapter @@ -72,43 +71,43 @@ const Slack = require('slack'); const msg = Slack.chat.postMessage; const { markdown2Html } = require('../../services/markdown'); - //as a parameter, you will always get the serviceName, newListings and all the values, that //you have defined exports.config.fields. (This is being used for rendering in the frontend) exports.send = ({ serviceName, newListings, notificationConfig, jobKey }) => { - const { token, channel } = notificationConfig.find((adapter) => adapter.id === 'slack').fields; - return newListings.map((payload) => { - //tho whatever needs to be done to send the data to the receiver, make sure the format is human readable - }); + const { token, channel } = notificationConfig.find((adapter) => adapter.id === 'slack').fields; + return newListings.map((payload) => { + //tho whatever needs to be done to send the data to the receiver, make sure the format is human readable + }); }; exports.config = { - id: __filename.slice(__dirname.length + 1, -3), - name: 'someUniqueName, used in the frontend', - //this readme is rendered in the frontend to explain how to use this - readme: markdown2Html('lib/notification/adapter/slack.md'), - description: 'Some description text rendered on the notification page', - fields: { - token: { - //type can be text/number/boolean - type: 'text', - label: 'Token', - description: 'The token needed to send notifications to slack.', - }, - channel: { - type: 'channel', - label: 'Channel', - description: 'The channel where fredy should send notifications to.', - }, + id: __filename.slice(__dirname.length + 1, -3), + name: 'someUniqueName, used in the frontend', + //this readme is rendered in the frontend to explain how to use this + readme: markdown2Html('lib/notification/adapter/slack.md'), + description: 'Some description text rendered on the notification page', + fields: { + token: { + //type can be text/number/boolean + type: 'text', + label: 'Token', + description: 'The token needed to send notifications to slack.', }, + channel: { + type: 'channel', + label: 'Channel', + description: 'The channel where fredy should send notifications to.', + }, + }, }; - ``` #### Running Tests + If you've written a new provider you are an awesome person. If you now write tests for it, you are even more awesome. And who doesn't want to be more awesome, right? #### Codestyle + I'm using ESLint to maintain quote style and quality. Do not skip it... ##### To-do before merging: diff --git a/README.md b/README.md index 4d5fd24..8e0d350 100755 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ - + -![Test](https://github.com/orangecoding/fredy/actions/workflows/test.yml/badge.svg) [![Create and publish Docker image](https://github.com/orangecoding/fredy/actions/workflows/docker.yml/badge.svg)](https://github.com/orangecoding/fredy/actions/workflows/docker.yml) ![Check the sourcecode](https://github.com/orangecoding/fredy/actions/workflows/check_source.yml/badge.svg) +![Test](https://github.com/orangecoding/fredy/actions/workflows/test.yml/badge.svg) [![Create and publish Docker image](https://github.com/orangecoding/fredy/actions/workflows/docker.yml/badge.svg)](https://github.com/orangecoding/fredy/actions/workflows/docker.yml) ![Check the sourcecode](https://github.com/orangecoding/fredy/actions/workflows/check_source.yml/badge.svg) Searching an apartment in Germany can be a frustrating task. Not any longer though, as _Fredy_ will take over and will only notify you once new listings have been found that match your requirements. -_Fredy_ scrapes multiple services (Immonet, Immowelt etc.) and send new listings to you once they become available. The list of available services can easily be extended. For your convenience, _Fredy_ has a UI to help you configure your search jobs. +_Fredy_ scrapes multiple services (Immonet, Immowelt etc.) and send new listings to you once they become available. The list of available services can easily be extended. For your convenience, _Fredy_ has a UI to help you configure your search jobs. If _Fredy_ finds matching results, it will send them to you via Slack, Email, Telegram etc. (More adapters can be configured.) As _Fredy_ stores the listings it has found, new results will not be sent to you twice (and as a side-effect, _Fredy_ can show some statistics). Furthermore, _Fredy_ checks duplicates per scraping so that the same listings are not being sent twice or more when posted on various platforms (which happens more often than one might think). -# Sponsorship [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/orangecoding) +# Sponsorship [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/orangecoding) + If you like my work, consider becoming a sponsor. I'm not expecting anybody to pay for _Fredy_ or any other Open Source Project I'm maintaining, however keep in mind, I'm doing all of this in my spare time :) Thanks. [![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport) @@ -16,17 +17,20 @@ If you like my work, consider becoming a sponsor. I'm not expecting anybody to p _Fredy_ is supported by JetBrains under Open Source Support Program ## Demo + If you want to try out _Fredy_, you can access the demo version [here](https://fredy.orange-coding.net) 🤘 -## Usage +## Usage - Make sure to use Node.js 20 or above - Run the following commands: + ```ssh yarn yarn run start:backend yarn run start:frontend ``` + _Fredy_ will start with the default port, set to `9998`. You can access _Fredy_ by opening your browser at `http://localhost:9998`. The default login is `admin`, both for username and password. You should change the password as soon as possible when you plan to run Fredy on a server.

@@ -38,62 +42,79 @@ _Fredy_ will start with the default port, set to `9998`. You can access _Fredy_

## Understanding the fundamentals + There are 3 important parts in Fredy, that you need to understand to leverage the full power of _Fredy_. #### Provider + _Fredy_ supports multiple services. Immonet, Immowelt and Ebay are just a few examples. Those services are called providers within _Fredy_. When creating a new job, you can choose one or more providers. A provider contains the URL that points to the search results for the respective service. If you go to immonet.de and search for something, the displayed URL in the browser is what the provider needs to do its magic. **It is important that you order the search results by date, so that _Fredy_ always picks the latest results first!** #### Adapter + _Fredy_ supports multiple adapters, such as Slack, SendGrid, Telegram etc. A search job can have as many adapters as supported by _Fredy_. Each adapter needs different configuration values, which you have to provide when using them. An adapter dictates how the frontend renders by telling the frontend what information it needs in order to send listings to the user. #### Jobs + A Job wraps adapters and providers. _Fredy_ runs the configured jobs in a specific interval (can be configured in `/conf/config.json`). ## Creating your first job + To create your first job, click on the button "Create New Job" on the job table. The job creation dialog should be self-explanatory, however there is one important thing. When configuring providers, before copying the URL from your browser, make sure that you have sorted the results by date to make sure _Fredy_ always picks the latest results first. ## User management + As an administrator, you can create, edit and remove users from _Fredy_. Be careful, each job is connected to the user that has created the job. If you remove the user, their jobs will also be removed. # Development ### Running Fredy in development mode + Start the backend with: + ```shell yarn run start:backend:dev ``` + For the frontend, run: + ```shell yarn run start:frontend:dev ``` + You should now be able to access _Fredy_ from your browser. Check your Terminal to see what port the frontend is running on. ### Running Tests + To run the tests, run + ```shell yarn run test ``` # Architecture -![Architecture](/doc/architecture.jpg "Architecture") + +![Architecture](/doc/architecture.jpg 'Architecture') ### Immoscout + Immoscout has implemented advanced bot detection. In order to work around this, we are using a reversed engineered version of their mobile api. See [Immoscout Reverse Engineering Documentation](https://github.com/orangecoding/fredy/blob/master/reverse-engineered-immoscout.md) # Analytics -Fredy is completely free (and will always remain free). However, it would be a huge help if you’d allow me to collect some analytical data. -Before you freak out, let me explain... -If you agree, Fredy will send a ping to my Mixpanel project each time it runs. + +Fredy is completely free (and will always remain free). However, it would be a huge help if you’d allow me to collect some analytical data. +Before you freak out, let me explain... +If you agree, Fredy will send a ping to my Mixpanel project each time it runs. The data includes: names of active adapters/providers, OS, architecture, Node version, and language. The information is entirely anonymous and helps me understand which adapters/providers are most frequently used.

**Thanks**🤘 -# Docker -Use the Dockerfile in this repository to build an image. +# Docker -Example: `docker build -t fredy/fredy /path/to/your/Dockerfile` +Use the Dockerfile in this repository to build an image. + +Example: `docker build -t fredy/fredy /path/to/your/Dockerfile` Or use docker-compose: @@ -103,17 +124,18 @@ Or use the container that will be built automatically. `docker pull ghcr.io/orangecoding/fredy:master` -## Create & run a container +## Create & run a container Put your config.json into a path of your choice, such as `/path/to/your/conf/`. Example: `docker create --name fredy -v /path/to/your/conf/:/conf -p 9998:9998 fredy/fredy` -## Logs +## Logs -You can browse the logs with `docker logs fredy -f`. +You can browse the logs with `docker logs fredy -f`. ### 👐 Contributing + Thanks to all the people who already contributed! @@ -122,7 +144,6 @@ Thanks to all the people who already contributed! See [Contributing](https://github.com/orangecoding/fredy/blob/master/CONTRIBUTING.md) - ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=orangecoding/fredy&type=Date)](https://www.star-history.com/#orangecoding/fredy&Date) diff --git a/conf/config.json b/conf/config.json index e8c9521..b0003aa 100755 --- a/conf/config.json +++ b/conf/config.json @@ -1 +1,7 @@ -{"interval":"60","port":9998,"workingHours":{"from":"","to":""},"demoMode":false,"analyticsEnabled":null} \ No newline at end of file +{ + "interval": "60", + "port": 9998, + "workingHours": { "from": "", "to": "" }, + "demoMode": false, + "analyticsEnabled": null +} diff --git a/docker-compose.yml b/docker-compose.yml index f6d96f1..0061893 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.8' services: fredy: container_name: fredy @@ -12,5 +11,5 @@ services: - ./conf:/conf - ./db:/db ports: - - 9998:9998 + - 9998:9998 restart: unless-stopped diff --git a/index.html b/index.html index 56d5608..662d1a1 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,17 @@ - + - - - + + + Fredy - - - -
- - - \ No newline at end of file + + +
+ + + diff --git a/lib/api/routes/demoRouter.js b/lib/api/routes/demoRouter.js index 6eb6e0d..0bd5dfb 100644 --- a/lib/api/routes/demoRouter.js +++ b/lib/api/routes/demoRouter.js @@ -1,10 +1,10 @@ import restana from 'restana'; -import {config} from '../../utils.js'; +import { config } from '../../utils.js'; const service = restana(); const demoRouter = service.newRouter(); demoRouter.get('/', async (req, res) => { - res.body = Object.assign({}, {demoMode: config.demoMode}); + res.body = Object.assign({}, { demoMode: config.demoMode }); res.send(); }); diff --git a/lib/api/routes/generalSettingsRoute.js b/lib/api/routes/generalSettingsRoute.js index f125924..f6acbde 100644 --- a/lib/api/routes/generalSettingsRoute.js +++ b/lib/api/routes/generalSettingsRoute.js @@ -1,7 +1,7 @@ import restana from 'restana'; -import {config, getDirName, readConfigFromStorage, refreshConfig} from '../../utils.js'; +import { config, getDirName, readConfigFromStorage, refreshConfig } from '../../utils.js'; import fs from 'fs'; -import {handleDemoUser} from '../../services/storage/userStorage.js'; +import { handleDemoUser } from '../../services/storage/userStorage.js'; const service = restana(); const generalSettingsRouter = service.newRouter(); generalSettingsRouter.get('/', async (req, res) => { @@ -11,12 +11,12 @@ generalSettingsRouter.get('/', async (req, res) => { generalSettingsRouter.post('/', async (req, res) => { const settings = req.body; try { - if(config.demoMode){ + if (config.demoMode) { res.send(new Error('In demo mode, it is not allowed to change these settings.')); return; } const currentConfig = await readConfigFromStorage(); - fs.writeFileSync(`${getDirName()}/../conf/config.json`, JSON.stringify({...currentConfig, ...settings})); + fs.writeFileSync(`${getDirName()}/../conf/config.json`, JSON.stringify({ ...currentConfig, ...settings })); await refreshConfig(); handleDemoUser(); } catch (err) { diff --git a/lib/api/routes/loginRoute.js b/lib/api/routes/loginRoute.js index 7234021..0a2626d 100644 --- a/lib/api/routes/loginRoute.js +++ b/lib/api/routes/loginRoute.js @@ -1,8 +1,8 @@ import restana from 'restana'; import * as userStorage from '../../services/storage/userStorage.js'; import * as hasher from '../../services/security/hash.js'; -import {config} from '../../utils.js'; -import {trackDemoAccessed} from '../../services/tracking/Tracker.js'; +import { config } from '../../utils.js'; +import { trackDemoAccessed } from '../../services/tracking/Tracker.js'; const service = restana(); const loginRouter = service.newRouter(); loginRouter.get('/user', async (req, res) => { @@ -26,8 +26,7 @@ loginRouter.post('/', async (req, res) => { return; } if (user.password === hasher.hash(password)) { - - if(config.demoMode){ + if (config.demoMode) { trackDemoAccessed(); } diff --git a/lib/api/routes/notificationAdapterRouter.js b/lib/api/routes/notificationAdapterRouter.js index 483fa14..afcf205 100644 --- a/lib/api/routes/notificationAdapterRouter.js +++ b/lib/api/routes/notificationAdapterRouter.js @@ -6,7 +6,7 @@ const notificationAdapterList = fs.readdirSync('./lib//notification/adapter').fi const notificationAdapter = await Promise.all( notificationAdapterList.map(async (pro) => { return await import(`../../notification/adapter/${pro}`); - }) + }), ); notificationAdapterRouter.post('/try', async (req, res) => { const { id, fields } = req.body; diff --git a/lib/api/routes/providerRouter.js b/lib/api/routes/providerRouter.js index 2718baa..0ac5318 100644 --- a/lib/api/routes/providerRouter.js +++ b/lib/api/routes/providerRouter.js @@ -6,7 +6,7 @@ const providerList = fs.readdirSync('./lib/provider').filter((file) => file.ends const provider = await Promise.all( providerList.map(async (pro) => { return await import(`../../provider/${pro}`); - }) + }), ); providerRouter.get('/', async (req, res) => { res.body = provider.map((p) => p.metaInformation); diff --git a/lib/api/routes/userRoute.js b/lib/api/routes/userRoute.js index ade3cca..b2718d8 100644 --- a/lib/api/routes/userRoute.js +++ b/lib/api/routes/userRoute.js @@ -1,7 +1,7 @@ import restana from 'restana'; import * as userStorage from '../../services/storage/userStorage.js'; import * as jobStorage from '../../services/storage/jobStorage.js'; -import {config} from '../../utils.js'; +import { config } from '../../utils.js'; const service = restana(); const userRouter = service.newRouter(); function checkIfAnyAdminAfterRemovingUser(userIdToBeRemoved, allUser) { @@ -21,7 +21,7 @@ userRouter.get('/:userId', async (req, res) => { res.send(); }); userRouter.delete('/', async (req, res) => { - if(config.demoMode){ + if (config.demoMode) { res.send(new Error('In demo mode, it is not allowed to remove user.')); return; } @@ -42,10 +42,9 @@ userRouter.delete('/', async (req, res) => { res.send(); }); userRouter.post('/', async (req, res) => { - - if(config.demoMode){ - res.send(new Error('In demo mode, it is not allowed to change or add user.')); - return; + if (config.demoMode) { + res.send(new Error('In demo mode, it is not allowed to change or add user.')); + return; } const { username, password, password2, isAdmin, userId } = req.body; @@ -60,7 +59,7 @@ userRouter.post('/', async (req, res) => { const allUser = userStorage.getUsers(false); if (!isAdmin && !checkIfAnyAdminAfterRemovingUser(userId, allUser)) { res.send( - new Error('You cannot change the admin flag for this user as otherwise, there is no other user in the system') + new Error('You cannot change the admin flag for this user as otherwise, there is no other user in the system'), ); return; } diff --git a/lib/defaultConfig.js b/lib/defaultConfig.js index 0f2dcb8..56744f9 100644 --- a/lib/defaultConfig.js +++ b/lib/defaultConfig.js @@ -1,7 +1,7 @@ export const DEFAULT_CONFIG = { - 'interval': '60', - 'port': 9998, - 'workingHours': {'from': '', 'to': ''}, - 'demoMode': false, - 'analyticsEnabled': null - }; \ No newline at end of file + interval: '60', + port: 9998, + workingHours: { from: '', to: '' }, + demoMode: false, + analyticsEnabled: null, +}; diff --git a/lib/notification/adapter/console.md b/lib/notification/adapter/console.md index c3f6476..b5e3095 100644 --- a/lib/notification/adapter/console.md +++ b/lib/notification/adapter/console.md @@ -1,4 +1,4 @@ ### Console Adapter The console adapter prints everything found by Fredy into the console (not sending any notifications to you). This can be useful when you want to check if your search -criteria meet the expectations. \ No newline at end of file +criteria meet the expectations. diff --git a/lib/notification/adapter/mailJet.md b/lib/notification/adapter/mailJet.md index 673f7da..c0bc5a8 100644 --- a/lib/notification/adapter/mailJet.md +++ b/lib/notification/adapter/mailJet.md @@ -1,8 +1,8 @@ ### MailJet Adapter - -To use [MailJet](https://mailjet.com), you need to create an account. You'll need to decided from which email address you want Fredy to send from. - -E.g. if you use yourGmailAccount@gmail.com, you have to add this to MailJet and verify it as well. + +To use [MailJet](https://mailjet.com), you need to create an account. You'll need to decided from which email address you want Fredy to send from. + +E.g. if you use yourGmailAccount@gmail.com, you have to add this to MailJet and verify it as well. The given public/private api keys are needed in order to use MailJet with Fredy. Fredy will use the same template, it is using for SendGrid. -If this email should be sent to multiple receiver use a comma separator (some@email.com, someOther@email.com). +If this email should be sent to multiple receiver use a comma separator (some@email.com, someOther@email.com). diff --git a/lib/notification/adapter/mattermost.md b/lib/notification/adapter/mattermost.md index 8763579..f852a63 100644 --- a/lib/notification/adapter/mattermost.md +++ b/lib/notification/adapter/mattermost.md @@ -1,5 +1,5 @@ ### Mattermost Adapter -For Mattermost, you need to create a incoming webhook. This is pretty easy. Please visit the steps in the [developer docs](https://docs.mattermost.com/developer/webhooks-incoming.html) and follow the instructions. +For Mattermost, you need to create a incoming webhook. This is pretty easy. Please visit the steps in the [developer docs](https://docs.mattermost.com/developer/webhooks-incoming.html) and follow the instructions. -As a result, you get the webhook URL for configuration in fredy. In addition, the target channel must be defined. \ No newline at end of file +As a result, you get the webhook URL for configuration in fredy. In addition, the target channel must be defined. diff --git a/lib/notification/adapter/ntfy.md b/lib/notification/adapter/ntfy.md index 18fd391..40b3b5b 100644 --- a/lib/notification/adapter/ntfy.md +++ b/lib/notification/adapter/ntfy.md @@ -1,5 +1,5 @@ ### ntfy Adapter -For ntfy, you need to create a topic on your preferred ntfy instance. This is pretty easy. Please visit the steps in the [docs](https://docs.ntfy.sh/publish/) and follow the instructions. +For ntfy, you need to create a topic on your preferred ntfy instance. This is pretty easy. Please visit the steps in the [docs](https://docs.ntfy.sh/publish/) and follow the instructions. -As a result, you get the URL for configuration in fredy. In addition, the priority must be defined. \ No newline at end of file +As a result, you get the URL for configuration in fredy. In addition, the priority must be defined. diff --git a/lib/notification/adapter/pushover.js b/lib/notification/adapter/pushover.js index b9b7dd9..568eab8 100644 --- a/lib/notification/adapter/pushover.js +++ b/lib/notification/adapter/pushover.js @@ -1,73 +1,74 @@ -import {markdown2Html} from '../../services/markdown.js'; -import {getJob} from '../../services/storage/jobStorage.js'; +import { markdown2Html } from '../../services/markdown.js'; +import { getJob } from '../../services/storage/jobStorage.js'; import fetch from 'node-fetch'; -export const send = ({serviceName, newListings, notificationConfig, jobKey}) => { - const {token, user, device} = notificationConfig.find((adapter) => adapter.id === config.id).fields; - const job = getJob(jobKey); - const jobName = job == null ? jobKey : job.name; - const promises = newListings.map((newListing) => { - const title = `${jobName} at ${serviceName}: ${newListing.title}`; - const message = `Address: ${newListing.address}\nSize: ${newListing.size}\nPrice: ${newListing.price}\nLink: ${newListing.link}`; - return fetch('https://api.pushover.net/1/messages.json', { - method: 'POST', - headers: {'Content-Type': 'application/json'}, - body: JSON.stringify({ - token: token, - user: user, - message: message, - device: device, - title: title, - }), - }); +export const send = ({ serviceName, newListings, notificationConfig, jobKey }) => { + const { token, user, device } = notificationConfig.find((adapter) => adapter.id === config.id).fields; + const job = getJob(jobKey); + const jobName = job == null ? jobKey : job.name; + const promises = newListings.map((newListing) => { + const title = `${jobName} at ${serviceName}: ${newListing.title}`; + const message = `Address: ${newListing.address}\nSize: ${newListing.size}\nPrice: ${newListing.price}\nLink: ${newListing.link}`; + return fetch('https://api.pushover.net/1/messages.json', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + token: token, + user: user, + message: message, + device: device, + title: title, + }), }); + }); - return Promise.all(promises) - .then((responses) => { - // Convert all responses to JSON - return Promise.all(responses.map((response) => response.json())); - }) - .then((data) => { - // Check for errors in the data - const error = data - .map((item) => (item.errors != null && item.errors.length > 0 ? item.errors.join(', ') : null)) - .filter((err) => err !== null); + return Promise.all(promises) + .then((responses) => { + // Convert all responses to JSON + return Promise.all(responses.map((response) => response.json())); + }) + .then((data) => { + // Check for errors in the data + const error = data + .map((item) => (item.errors != null && item.errors.length > 0 ? item.errors.join(', ') : null)) + .filter((err) => err !== null); - if (error.length > 0) { - // Reject with the combined error messages - return Promise.reject(error.join('; ')); - } + if (error.length > 0) { + // Reject with the combined error messages + return Promise.reject(error.join('; ')); + } - return data; - }) - .then(() => { - return Promise.resolve(); - }) - .catch((error) => { - return Promise.reject(error); - }); + return data; + }) + .then(() => { + return Promise.resolve(); + }) + .catch((error) => { + return Promise.reject(error); + }); }; export const config = { - id: 'pushover', - name: 'Pushover', - readme: markdown2Html('lib/notification/adapter/pushover.md'), - description: 'Fredy will send new listings to your mobile using Pushover.', - fields: { - token: { - type: 'text', - label: 'API token', - description: 'Your application\'s API token.', - }, - user: { - type: 'text', - label: 'User key', - description: 'Your user/group key.', - }, - device: { - type: 'text', - label: 'Device name', - description: 'The device name to send your notification to. Messages may be addressed to multiple specific devices by joining them with a comma.', - }, + id: 'pushover', + name: 'Pushover', + readme: markdown2Html('lib/notification/adapter/pushover.md'), + description: 'Fredy will send new listings to your mobile using Pushover.', + fields: { + token: { + type: 'text', + label: 'API token', + description: "Your application's API token.", }, + user: { + type: 'text', + label: 'User key', + description: 'Your user/group key.', + }, + device: { + type: 'text', + label: 'Device name', + description: + 'The device name to send your notification to. Messages may be addressed to multiple specific devices by joining them with a comma.', + }, + }, }; diff --git a/lib/notification/adapter/pushover.md b/lib/notification/adapter/pushover.md index 4eaf0a3..2bb02ef 100644 --- a/lib/notification/adapter/pushover.md +++ b/lib/notification/adapter/pushover.md @@ -2,4 +2,4 @@ Refer to the [instructions](https://support.pushover.net/i7-what-is-pushover-and-how-do-i-use-it) to set up your Pushover application. -After setting up the application, please enter both your newly created User key and API token. \ No newline at end of file +After setting up the application, please enter both your newly created User key and API token. diff --git a/lib/notification/adapter/sendGrid.md b/lib/notification/adapter/sendGrid.md index 2aef95d..31b9444 100644 --- a/lib/notification/adapter/sendGrid.md +++ b/lib/notification/adapter/sendGrid.md @@ -1,9 +1,8 @@ ### SendGrid Adapter - SendGrid is a free email service (free as in "you cannot send more than 100(Sendgrid) and 200(Mailjet) emails a day"), which is more than enough for Fredy. - -To use [SendGrid](https://sendgrid.com/), you need to create an account. You'll need to decided from which email address you want Fredy to send from. E.g. if you use yourGmailAccount@gmail.com, you have to add this to sendgrid and verify it as well. + +To use [SendGrid](https://sendgrid.com/), you need to create an account. You'll need to decided from which email address you want Fredy to send from. E.g. if you use yourGmailAccount@gmail.com, you have to add this to sendgrid and verify it as well. Lastly you have to create an api-key and feed it into Fredy's config, as well as creating a new dynamic template. For this new template, I recommend copying and pasting the code from the one I have provided under `/lib/notification/emailTemplate/template.hbs`. diff --git a/lib/notification/adapter/slack.md b/lib/notification/adapter/slack.md index ccbe4cd..8789593 100644 --- a/lib/notification/adapter/slack.md +++ b/lib/notification/adapter/slack.md @@ -1,6 +1,5 @@ ### Slack Adapter - -In order to use [Slack](https://slack.com), you need to create an account. When done, you need to create a new App in your workspace. Give it the permission `chat:write:bot` and `chat:write:user`. - -Now you need to create a user token and a channel. Make sure the bot is installed to this channel. +In order to use [Slack](https://slack.com), you need to create an account. When done, you need to create a new App in your workspace. Give it the permission `chat:write:bot` and `chat:write:user`. + +Now you need to create a user token and a channel. Make sure the bot is installed to this channel. diff --git a/lib/notification/adapter/sqlite.md b/lib/notification/adapter/sqlite.md index 34f63eb..6b455b5 100644 --- a/lib/notification/adapter/sqlite.md +++ b/lib/notification/adapter/sqlite.md @@ -1,7 +1,9 @@ ### Sqlite Adapter -This adapter stores search results in a sqlite database located in db/listings.db. This file can be used for further analysis later on. + +This adapter stores search results in a sqlite database located in db/listings.db. This file can be used for further analysis later on. Fields are: + ``` ['serviceName', 'jobKey', 'id', 'size', 'rooms', 'price', 'address', 'title', 'link', 'description'] -``` \ No newline at end of file +``` diff --git a/lib/notification/adapter/telegram.js b/lib/notification/adapter/telegram.js index 8e1ecf5..0c6e81c 100644 --- a/lib/notification/adapter/telegram.js +++ b/lib/notification/adapter/telegram.js @@ -28,11 +28,13 @@ export const send = ({ serviceName, newListings, notificationConfig, jobKey }) = const messageParagraphs = []; messageParagraphs.push(`${jobName} (${serviceName}) found ${newListings.length} new listings:`); - messageParagraphs.push(...chunk.map( - (o) => - `
${shorten(o.title.replace(/\*/g, ''), 45).trim()}\n` + - [o.address, o.price, o.size].join(' | ') - )); + messageParagraphs.push( + ...chunk.map( + (o) => + `${shorten(o.title.replace(/\*/g, ''), 45).trim()}\n` + + [o.address, o.price, o.size].join(' | '), + ), + ); /** * This is to not break the rate limit. It is to only send 1 message per second diff --git a/lib/notification/adapter/telegram.md b/lib/notification/adapter/telegram.md index a88230f..9ab0841 100644 --- a/lib/notification/adapter/telegram.md +++ b/lib/notification/adapter/telegram.md @@ -1,13 +1,12 @@ ### Telegram Adapter - For Telegram, you need to create a Bot. This is pretty easy. Open [this](https://telegram.me/BotFather) url on your smartphone and follow the instructions. - -A telegram bot is not allowed to send messages directly to a user, you as a user need to first contact the bot to get a chatId. -After the user has send a message to your bot the first time, you can gather the chatId like this: -``` -curl -X GET https://api.telegram.org/bot{YOUR_TELEGRAM_TOKEN}/getUpdates -``` - +A telegram bot is not allowed to send messages directly to a user, you as a user need to first contact the bot to get a chatId. +After the user has send a message to your bot the first time, you can gather the chatId like this: + +``` +curl -X GET https://api.telegram.org/bot{YOUR_TELEGRAM_TOKEN}/getUpdates +``` + A more detailed list of instructions can be found here [https://core.telegram.org/bots#botfather](https://core.telegram.org/bots#botfather) diff --git a/lib/services/tracking/Tracker.js b/lib/services/tracking/Tracker.js index b9f0515..04e6b60 100644 --- a/lib/services/tracking/Tracker.js +++ b/lib/services/tracking/Tracker.js @@ -1,90 +1,90 @@ import Mixpanel from 'mixpanel'; -import {getJobs} from '../storage/jobStorage.js'; -import {getUniqueId} from './uniqueId.js'; -import {config, inDevMode} from '../../utils.js'; +import { getJobs } from '../storage/jobStorage.js'; +import { getUniqueId } from './uniqueId.js'; +import { config, inDevMode } from '../../utils.js'; import os from 'os'; -import {readFileSync} from 'fs'; -import {packageUp} from 'package-up'; +import { readFileSync } from 'fs'; +import { packageUp } from 'package-up'; const mixpanelTracker = Mixpanel.init('718670ef1c58c0208256c1e408a3d75e'); const distinct_id = getUniqueId() || 'N/A'; const version = await getPackageVersion(); export const track = function () { - //only send tracking information if the user allowed to do so. - if (config.analyticsEnabled && !inDevMode()) { - const activeProvider = new Set(); - const activeAdapter = new Set(); + //only send tracking information if the user allowed to do so. + if (config.analyticsEnabled && !inDevMode()) { + const activeProvider = new Set(); + const activeAdapter = new Set(); - const jobs = getJobs(); + const jobs = getJobs(); - if (jobs != null && jobs.length > 0) { - jobs.forEach((job) => { - job.provider.forEach((provider) => { - activeProvider.add(provider.id); - }); - job.notificationAdapter.forEach((adapter) => { - activeAdapter.add(adapter.id); - }); - }); + if (jobs != null && jobs.length > 0) { + jobs.forEach((job) => { + job.provider.forEach((provider) => { + activeProvider.add(provider.id); + }); + job.notificationAdapter.forEach((adapter) => { + activeAdapter.add(adapter.id); + }); + }); - mixpanelTracker.track( - 'fredy_tracking', - enrichTrackingObject({ - adapter: Array.from(activeAdapter), - provider: Array.from(activeProvider), - }), - ); - } + mixpanelTracker.track( + 'fredy_tracking', + enrichTrackingObject({ + adapter: Array.from(activeAdapter), + provider: Array.from(activeProvider), + }), + ); } + } }; /** * Note, this will only be used when Fredy runs in demo mode */ export function trackDemoJobCreated(jobData) { - if (config.analyticsEnabled && !inDevMode() && config.demoMode) { - mixpanelTracker.track('demoJobCreated', enrichTrackingObject(jobData)); - } + if (config.analyticsEnabled && !inDevMode() && config.demoMode) { + mixpanelTracker.track('demoJobCreated', enrichTrackingObject(jobData)); + } } /** * Note, this will only be used when Fredy runs in demo mode */ export function trackDemoAccessed() { - if (config.analyticsEnabled && !inDevMode() && config.demoMode) { - mixpanelTracker.track('demoAccessed', enrichTrackingObject({})); - } + if (config.analyticsEnabled && !inDevMode() && config.demoMode) { + mixpanelTracker.track('demoAccessed', enrichTrackingObject({})); + } } function enrichTrackingObject(trackingObject) { - const operating_system = os.platform(); - const os_version = os.release(); - const arch = process.arch; - const language = process.env.LANG || 'en'; - const nodeVersion = process.version || 'N/A'; + const operating_system = os.platform(); + const os_version = os.release(); + const arch = process.arch; + const language = process.env.LANG || 'en'; + const nodeVersion = process.version || 'N/A'; - return { - ...trackingObject, - isDemo: config.demoMode, - operating_system, - os_version, - arch, - nodeVersion, - language, - distinct_id, - fredy_version: version - }; + return { + ...trackingObject, + isDemo: config.demoMode, + operating_system, + os_version, + arch, + nodeVersion, + language, + distinct_id, + fredy_version: version, + }; } async function getPackageVersion() { - try { - const packagePath = await packageUp(); - const packageJson = readFileSync(packagePath, 'utf8'); - const json = JSON.parse(packageJson); - return json.version; - } catch (error) { - console.error('Error reading version from package.json', error); - } - return 'N/A'; + try { + const packagePath = await packageUp(); + const packageJson = readFileSync(packagePath, 'utf8'); + const json = JSON.parse(packageJson); + return json.version; + } catch (error) { + console.error('Error reading version from package.json', error); + } + return 'N/A'; } diff --git a/lib/utils.js b/lib/utils.js index c8a6449..649eb17 100755 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,88 +1,86 @@ -import {dirname} from 'node:path'; -import {fileURLToPath} from 'node:url'; -import {readFile} from 'fs/promises'; -import {createHash} from 'crypto'; -import {DEFAULT_CONFIG} from './defaultConfig.js'; +import { dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { readFile } from 'fs/promises'; +import { createHash } from 'crypto'; +import { DEFAULT_CONFIG } from './defaultConfig.js'; -function inDevMode(){ - return process.env.NODE_ENV == null || process.env.NODE_ENV !== 'production'; +function inDevMode() { + return process.env.NODE_ENV == null || process.env.NODE_ENV !== 'production'; } function isOneOf(word, arr) { - if (!arr || arr.length === 0 || word == null) return false; - const lowerWord = word.toLowerCase(); - return arr.some(item => lowerWord.indexOf(item.toLowerCase()) !== -1); + if (!arr || arr.length === 0 || word == null) return false; + const lowerWord = word.toLowerCase(); + return arr.some((item) => lowerWord.indexOf(item.toLowerCase()) !== -1); } function nullOrEmpty(val) { - return val == null || val.length === 0; + return val == null || val.length === 0; } function timeStringToMs(timeString, now) { - const d = new Date(now); - const parts = timeString.split(':'); - d.setHours(parts[0]); - d.setMinutes(parts[1]); - d.setSeconds(0); - return d.getTime(); + const d = new Date(now); + const parts = timeString.split(':'); + d.setHours(parts[0]); + d.setMinutes(parts[1]); + d.setSeconds(0); + return d.getTime(); } function duringWorkingHoursOrNotSet(config, now) { - const {workingHours} = config; - if (workingHours == null || nullOrEmpty(workingHours.from) || nullOrEmpty(workingHours.to)) { - return true; - } - const toDate = timeStringToMs(workingHours.to, now); - const fromDate = timeStringToMs(workingHours.from, now); - return fromDate <= now && toDate >= now; + const { workingHours } = config; + if (workingHours == null || nullOrEmpty(workingHours.from) || nullOrEmpty(workingHours.to)) { + return true; + } + const toDate = timeStringToMs(workingHours.to, now); + const fromDate = timeStringToMs(workingHours.from, now); + return fromDate <= now && toDate >= now; } function getDirName() { - return dirname(fileURLToPath(import.meta.url)); + return dirname(fileURLToPath(import.meta.url)); } function buildHash(...inputs) { - if (inputs == null) { - return null; - } - const cleaned = inputs.filter(i => i != null && i.length > 0); - if (cleaned.length === 0) { - return null; - } - return createHash('sha256') - .update(cleaned.join(',')) - .digest('hex'); + if (inputs == null) { + return null; + } + const cleaned = inputs.filter((i) => i != null && i.length > 0); + if (cleaned.length === 0) { + return null; + } + return createHash('sha256').update(cleaned.join(',')).digest('hex'); } let config = {}; -export async function readConfigFromStorage(){ - return JSON.parse(await readFile(new URL('../conf/config.json', import.meta.url))); +export async function readConfigFromStorage() { + return JSON.parse(await readFile(new URL('../conf/config.json', import.meta.url))); } -export async function refreshConfig(){ - try { - config = await readConfigFromStorage(); - //backwards compatability... - config.analyticsEnabled ??= null; - config.demoMode ??= false; - } catch (error) { - config = {...DEFAULT_CONFIG}; - console.error('Error reading config file', error); - } +export async function refreshConfig() { + try { + config = await readConfigFromStorage(); + //backwards compatability... + config.analyticsEnabled ??= null; + config.demoMode ??= false; + } catch (error) { + config = { ...DEFAULT_CONFIG }; + console.error('Error reading config file', error); + } } await refreshConfig(); -export {isOneOf}; -export {inDevMode}; -export {nullOrEmpty}; -export {duringWorkingHoursOrNotSet}; -export {getDirName}; -export {config}; -export {buildHash}; +export { isOneOf }; +export { inDevMode }; +export { nullOrEmpty }; +export { duringWorkingHoursOrNotSet }; +export { getDirName }; +export { config }; +export { buildHash }; export default { - isOneOf, - nullOrEmpty, - duringWorkingHoursOrNotSet, - getDirName, - config, + isOneOf, + nullOrEmpty, + duringWorkingHoursOrNotSet, + getDirName, + config, }; diff --git a/package.json b/package.json index 79fb7fb..936b517 100755 --- a/package.json +++ b/package.json @@ -9,10 +9,10 @@ "start:frontend": "vite -m production", "start:frontend:dev": "vite", "build:frontend": "vite build", - "format": "prettier --write lib/**/*.js ui/src/**/*.jsx test/**/*.js *.js", - "format:check": "prettier --check lib/**/*.js ui/src/**/*.jsx test/**/*.js *.js", + "format": "prettier --write .", + "format:check": "prettier --check .", "test": "mocha --loader=esmock --timeout 3000000 test/**/*.test.js", - "lint": "eslint index.js lib/**/*.js test/**/*.js ui/src/**/*.jsx", + "lint": "eslint .", "lint:fix": "yarn lint --fix" }, "type": "module", diff --git a/reverse-engineered-immoscout.md b/reverse-engineered-immoscout.md index b1f48ec..99e311c 100644 --- a/reverse-engineered-immoscout.md +++ b/reverse-engineered-immoscout.md @@ -22,22 +22,24 @@ These protections make it extremely difficult to reliably extract data from Immo To work around these limitations, we are in the progress of reverse-engineering Immoscout24's mobile API. The mobile applications need to communicate with Immoscout's servers to retrieve listing data, and these API endpoints typically have fewer anti-bot protections than the web interface. -The mobile API provides several key endpoints: +The mobile API provides several key endpoints: + - Search total endpoint: Returns the total number of listings for a given query - Search list endpoint: Retrieves the actual listings with details - Expose endpoint: Returns detailed information about a specific listing -Challenges: +Challenges: + 1. Identifying the necessary endpoints and parameters required to perform searches 2. Mapping the mobile API parameters to their web counterparts to maintain compatibility with existing search URLs - ## Api Specs #### Search for Listings -`GET /search/total?{search parameters}` -*Returns the total number of listings for the given query.* +`GET /search/total?{search parameters}` +_Returns the total number of listings for the given query._ + ``` curl -H "User-Agent: ImmoScout24_1410_30_._" \ -H "Accept: application/json" \ @@ -47,14 +49,17 @@ curl -H "User-Agent: ImmoScout24_1410_30_._" \ --- #### Retrieve the listings -`POST /search/list?{search parameters}` -*The body is json encoded and contains data specifying additional results (advertisements) to return. The format is as follows (It is not necessary to provide data for the specified keys.)* - ``` - { - "supportedResultListTypes": [], - "userData": {} - } - ``` + +`POST /search/list?{search parameters}` +_The body is json encoded and contains data specifying additional results (advertisements) to return. The format is as follows (It is not necessary to provide data for the specified keys.)_ + +``` +{ +"supportedResultListTypes": [], +"userData": {} +} +``` + ``` curl -X POST 'https://api.mobile.immobilienscout24.de/search/list?pricetype=calculatedtotalrent&realestatetype=apartmentrent&searchType=region&geocodes=%2Fde%2Fberlin%2Fberlin&pagenumber=1' \ -H "Connection: keep-alive" \ @@ -66,15 +71,18 @@ curl -X POST 'https://api.mobile.immobilienscout24.de/search/list?pricetype=calc ``` --- + #### Get details of listings + `GET /expose/{id}` The response contains additional details not included in the listing response. + ``` curl -H "User-Agent: ImmoScout24_1410_30_._" \ -H "Accept: application/json" \ "https://api.mobile.immobilienscout24.de/expose/158382494" ``` +## Parameters -## Parameters The parameters between web and mobile are very different which is why we have to translate them. Please see [/lib/services/immoscout/immoscout-web-translator.js](https://github.com/orangecoding/fredy/blob/master/lib/services/immoscout/immoscout-web-translator.js). diff --git a/test/queryStringMutator/testData.json b/test/queryStringMutator/testData.json index 8a41d83..8656b87 100644 --- a/test/queryStringMutator/testData.json +++ b/test/queryStringMutator/testData.json @@ -30,4 +30,4 @@ "shouldBecome": "https://www.immobilienscout24.de/Suche/de/nordrhein-westfalen/duesseldorf/wohnung-mieten?numberofrooms=1.5-&price=1.0-1000000.0&livingspace=1.0-10000.0&pricetype=rentpermonth&enteredFrom=result_list&sorting=-firstactivation", "id": "immoscout" } -] \ No newline at end of file +] diff --git a/test/services/immoscout/testdata.json b/test/services/immoscout/testdata.json index 62d0284..9b37123 100644 --- a/test/services/immoscout/testdata.json +++ b/test/services/immoscout/testdata.json @@ -19,4 +19,4 @@ "url": "https://www.immobilienscout24.de/Suche/de/nordrhein-westfalen/duesseldorf/haus-mieten?enteredFrom=one_step_search", "type": "houserent" } -} \ No newline at end of file +} diff --git a/ui/src/App.less b/ui/src/App.less index d91c897..c3bc301 100644 --- a/ui/src/App.less +++ b/ui/src/App.less @@ -1,7 +1,7 @@ .app { - display:flex; + display: flex; flex-direction: column; - width:100%; + width: 100%; &__container { padding: 1rem 1rem; @@ -10,12 +10,13 @@ } } -.ui.inverted.segment{ - background: #31303078!important; +.ui.inverted.segment { + background: #31303078 !important; } -.ui.black.label, .ui.black.labels .label { - background-color: #31303078!important; +.ui.black.label, +.ui.black.labels .label { + background-color: #31303078 !important; } a:link { diff --git a/ui/src/Index.less b/ui/src/Index.less index ae3b916..f9717f6 100644 --- a/ui/src/Index.less +++ b/ui/src/Index.less @@ -1,15 +1,16 @@ -body, html { +body, +html { margin: 0; height: 100%; width: 100%; background-color: #232429; } -.semi-table-row-head{ +.semi-table-row-head { background-color: #2b2b2b !important; color: #fff !important; } .semi-table-row-cell { background-color: #333333 !important; -} \ No newline at end of file +} diff --git a/ui/src/components/logo/Logo.less b/ui/src/components/logo/Logo.less index 3427e93..beb83cd 100644 --- a/ui/src/components/logo/Logo.less +++ b/ui/src/components/logo/Logo.less @@ -1,5 +1,5 @@ .logo { position: absolute; - top: .1rem; + top: 0.1rem; right: 2rem; -} \ No newline at end of file +} diff --git a/ui/src/components/placeholder/Placeholder.less b/ui/src/components/placeholder/Placeholder.less index dddf1a2..0c5693a 100644 --- a/ui/src/components/placeholder/Placeholder.less +++ b/ui/src/components/placeholder/Placeholder.less @@ -1,10 +1,10 @@ .place { height: 100%; width: 100%; - display:flex; + display: flex; - &__place_lines_wrapper{ - width:100%; + &__place_lines_wrapper { + width: 100%; } &__line { @@ -20,17 +20,16 @@ border-radius: 360px; animation: pulse 1s infinite ease-in-out; } - } @keyframes pulse { 0% { - background-color: rgba(165, 165, 165, 0.1) + background-color: rgba(165, 165, 165, 0.1); } 50% { - background-color: rgba(165, 165, 165, 0.3) + background-color: rgba(165, 165, 165, 0.3); } 100% { - background-color: rgba(165, 165, 165, 0.1) + background-color: rgba(165, 165, 165, 0.1); } } diff --git a/ui/src/components/segment/SegmentParts.less b/ui/src/components/segment/SegmentParts.less index 0ecc660..c94386a 100644 --- a/ui/src/components/segment/SegmentParts.less +++ b/ui/src/components/segment/SegmentParts.less @@ -1,4 +1,4 @@ .segmentParts { border: 1px solid #323232 !important; border-radius: 5px !important; -} \ No newline at end of file +} diff --git a/ui/src/components/tracking/TrackingModal.less b/ui/src/components/tracking/TrackingModal.less index fb8c177..267f74f 100644 --- a/ui/src/components/tracking/TrackingModal.less +++ b/ui/src/components/tracking/TrackingModal.less @@ -1,5 +1,5 @@ .trackingModal { &__description { - margin-top:10rem; + margin-top: 10rem; } -} \ No newline at end of file +} diff --git a/ui/src/services/developmentMode.js b/ui/src/services/developmentMode.js index d48944c..5074c63 100644 --- a/ui/src/services/developmentMode.js +++ b/ui/src/services/developmentMode.js @@ -1,4 +1,4 @@ -export default function isDevelopmentMode(){ - const inDevMode= import.meta.env.MODE; - return inDevMode != null && inDevMode === 'development'; -} \ No newline at end of file +export default function isDevelopmentMode() { + const inDevMode = import.meta.env.MODE; + return inDevMode != null && inDevMode === 'development'; +} diff --git a/ui/src/services/xhr.js b/ui/src/services/xhr.js index a494b6c..71a4e8b 100644 --- a/ui/src/services/xhr.js +++ b/ui/src/services/xhr.js @@ -129,6 +129,6 @@ function parseJSON(response) { }); } }) - .catch((error) => reject('Error while trying to parse json.', error)) + .catch((error) => reject('Error while trying to parse json.', error)), ); } diff --git a/ui/src/views/generalSettings/GeneralSettings.less b/ui/src/views/generalSettings/GeneralSettings.less index d556829..a2e63d0 100644 --- a/ui/src/views/generalSettings/GeneralSettings.less +++ b/ui/src/views/generalSettings/GeneralSettings.less @@ -5,9 +5,8 @@ gap: 1rem; } - &__help{ + &__help { font-size: 11px; margin-left: 1rem; } - } diff --git a/ui/src/views/jobs/Jobs.less b/ui/src/views/jobs/Jobs.less index 8374176..a6b600b 100644 --- a/ui/src/views/jobs/Jobs.less +++ b/ui/src/views/jobs/Jobs.less @@ -1,7 +1,7 @@ .jobs { - &__newButton{ - margin-top:1rem !important; + &__newButton { + margin-top: 1rem !important; float: right; margin-bottom: 1rem !important; } -} \ No newline at end of file +} diff --git a/ui/src/views/jobs/mutation/JobMutation.less b/ui/src/views/jobs/mutation/JobMutation.less index 1c58ee6..2f14cb0 100644 --- a/ui/src/views/jobs/mutation/JobMutation.less +++ b/ui/src/views/jobs/mutation/JobMutation.less @@ -1,5 +1,5 @@ .jobMutation { - &__newButton{ + &__newButton { float: right; margin-bottom: 1rem; } @@ -7,4 +7,4 @@ .semi-select-option-list-wrapper { width: 25rem; -} \ No newline at end of file +} diff --git a/ui/src/views/jobs/mutation/components/notificationAdapter/NotificationAdapterMutator.less b/ui/src/views/jobs/mutation/components/notificationAdapter/NotificationAdapterMutator.less index b68510b..a4a047f 100644 --- a/ui/src/views/jobs/mutation/components/notificationAdapter/NotificationAdapterMutator.less +++ b/ui/src/views/jobs/mutation/components/notificationAdapter/NotificationAdapterMutator.less @@ -1,6 +1,6 @@ .providerMutator { - &__fields{ - width:25rem !important; + &__fields { + width: 25rem !important; } &__helpBox { @@ -9,8 +9,8 @@ padding: 1rem !important; } - &__helpLink{ + &__helpLink { color: #4183c4; cursor: pointer; } -} \ No newline at end of file +} diff --git a/ui/src/views/jobs/mutation/components/provider/ProviderMutator.less b/ui/src/views/jobs/mutation/components/provider/ProviderMutator.less index c9998c6..dd6a904 100644 --- a/ui/src/views/jobs/mutation/components/provider/ProviderMutator.less +++ b/ui/src/views/jobs/mutation/components/provider/ProviderMutator.less @@ -1,5 +1,5 @@ .providerMutator { - &__fields{ - width:25rem !important; + &__fields { + width: 25rem !important; } -} \ No newline at end of file +} diff --git a/ui/src/views/user/Users.less b/ui/src/views/user/Users.less index 12c9b56..d492117 100644 --- a/ui/src/views/user/Users.less +++ b/ui/src/views/user/Users.less @@ -1,7 +1,7 @@ .users { - &__newButton{ - margin-top:1rem !important; + &__newButton { + margin-top: 1rem !important; float: right; margin-bottom: 1rem !important; } -} \ No newline at end of file +} diff --git a/ui/src/views/user/mutation/UserMutator.less b/ui/src/views/user/mutation/UserMutator.less index c5c47d1..81ae90d 100644 --- a/ui/src/views/user/mutation/UserMutator.less +++ b/ui/src/views/user/mutation/UserMutator.less @@ -1,3 +1,3 @@ .userMutator { - margin-top: 2rem ; -} \ No newline at end of file + margin-top: 2rem; +}