Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/orangecoding/fredy
Browse files Browse the repository at this point in the history
  • Loading branch information
orangecoding committed Sep 7, 2023
2 parents 88c6641 + f4eedda commit deec626
Show file tree
Hide file tree
Showing 7 changed files with 495 additions and 474 deletions.
2 changes: 1 addition & 1 deletion lib/services/scrapingAnt.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { metaInformation as immoScoutInfo } from '../provider/immoscout.js';
import { metaInformation as immoNetInfo } from '../provider/immonet.js';
import { config } from '../utils.js';

const additionalImmonetUrlParams = `&wait_for_selector=.content-wrapper-tiles&js_snippet=${new Buffer(
const additionalImmonetUrlParams = `&wait_for_selector=.content-wrapper-tiles&js_snippet=${Buffer.from(
'window.scrollTo(0,document.body.scrollHeight);'
).toString('base64')}`;

Expand Down
4 changes: 2 additions & 2 deletions lib/services/storage/LowDashAdapter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import lodash from 'lodash';
import { LowSync } from 'lowdb';
export default class LowdashAdapter extends LowSync {
constructor(adapter) {
super(adapter);
constructor(adapter, defaultData = {}) {
super(adapter, defaultData);
this.chain = lodash.chain(this).get('data');
}
}
3 changes: 1 addition & 2 deletions lib/services/storage/jobStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import LowdashAdapter from './LowDashAdapter.js';

const file = path.join(getDirName(), '../', 'db/jobs.json');
const adapter = new JSONFileSync(file);
const db = new LowdashAdapter(adapter);
const db = new LowdashAdapter(adapter, { jobs: [] });

db.read();

db.data ||= { jobs: [] };

export const upsertJob = ({ jobId, name, blacklist = [], enabled = true, provider, notificationAdapter, userId }) => {
const currentJob =
Expand Down
4 changes: 1 addition & 3 deletions lib/services/storage/listingsStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import LowdashAdapter from './LowDashAdapter.js';

const file = path.join(getDirName(), '../', 'db/jobListingData.json');
const adapter = new JSONFileSync(file);
const db = new LowdashAdapter(adapter);
const db = new LowdashAdapter(adapter, {});

db.read();

db.data ||= {};

const buildKey = (jobKey, providerId, endpoint) => {
let key = `${jobKey}`;
if (jobKey == null && endpoint == null) {
Expand Down
28 changes: 14 additions & 14 deletions lib/services/storage/userStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ import * as jobStorage from './jobStorage.js';
import path from 'path';
import LowdashAdapter from './LowDashAdapter.js';

const defaultData = {
user: [
//you probably want to change the default password ;)
{
id: nanoid(),
lastLogin: Date.now(),
username: 'admin',
password: hasher.hash('admin'),
isAdmin: true,
},
],
};

const file = path.join(getDirName(), '../', 'db/users.json');
const adapter = new JSONFileSync(file);
const db = new LowdashAdapter(adapter);
const db = new LowdashAdapter(adapter, defaultData);

db.read();
db.data ||= {
user: [
//you probably want to change the default password ;)
{
id: nanoid(),
lastLogin: Date.now(),
username: 'admin',
password: hasher.hash('admin'),
isAdmin: true,
isDemo: false,
},
],
};

export const getUsers = (withPassword) => {
const jobs = jobStorage.getJobs();
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fredy",
"version": "7.2.1",
"version": "7.3.1",
"description": "[F]ind [R]eal [E]states [d]amn eas[y].",
"scripts": {
"start": "node index.js",
Expand Down Expand Up @@ -55,21 +55,21 @@
"Firefox ESR"
],
"dependencies": {
"@douyinfe/semi-ui": "2.31.0",
"@douyinfe/semi-ui": "2.34.2",
"@rematch/core": "2.2.0",
"@rematch/loading": "2.1.2",
"@sendgrid/mail": "7.7.0",
"@vitejs/plugin-react": "3.1.0",
"@vitejs/plugin-react": "4.0.0",
"better-sqlite3": "8.2.0",
"body-parser": "1.20.2",
"cookie-session": "2.0.0",
"handlebars": "4.7.7",
"highcharts": "10.3.3",
"highcharts": "11.0.1",
"highcharts-react-official": "3.2.0",
"lodash": "4.17.21",
"lowdb": "5.1.0",
"lowdb": "6.0.1",
"markdown": "^0.5.0",
"nanoid": "4.0.1",
"nanoid": "4.0.2",
"node-fetch": "3.3.1",
"node-mailjet": "6.0.2",
"query-string": "8.1.0",
Expand All @@ -84,25 +84,25 @@
"serve-static": "1.15.0",
"slack": "11.0.2",
"string-similarity": "^4.0.4",
"vite": "4.2.0",
"vite": "4.3.5",
"x-ray": "2.3.4"
},
"devDependencies": {
"@babel/core": "7.21.3",
"@babel/eslint-parser": "7.21.3",
"@babel/preset-env": "7.20.2",
"@babel/core": "7.21.8",
"@babel/eslint-parser": "7.21.8",
"@babel/preset-env": "7.21.5",
"@babel/preset-react": "7.18.6",
"chai": "4.3.7",
"eslint": "8.36.0",
"eslint-config-prettier": "8.7.0",
"eslint": "8.40.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-react": "7.32.2",
"esmock": "2.1.0",
"esmock": "2.2.2",
"history": "5.3.0",
"husky": "4.3.8",
"less": "4.1.3",
"lint-staged": "13.2.0",
"lint-staged": "13.2.2",
"mocha": "10.2.0",
"prettier": "2.8.5",
"prettier": "2.8.8",
"redux-logger": "3.0.6"
}
}
Loading

0 comments on commit deec626

Please sign in to comment.