fixing some bugs the wife found ;)

This commit is contained in:
orangecoding
2026-01-28 21:25:48 +01:00
parent 797421f0d5
commit bc355fb5fe
5 changed files with 22 additions and 14 deletions

View File

@@ -173,7 +173,7 @@ jobRouter.post('/', async (req, res) => {
return; return;
} }
if (settings.demoMode && jobFromDb.name === DEMO_JOB_NAME) { if (settings.demoMode && jobFromDb && jobFromDb.name === DEMO_JOB_NAME) {
res.send(new Error('Sorry, but you cannot change the Status of our Demo Job ;)')); res.send(new Error('Sorry, but you cannot change the Status of our Demo Job ;)'));
return; return;
} }

View File

@@ -10,6 +10,7 @@ import { isAdmin as isAdminFn } from '../security.js';
import logger from '../../services/logger.js'; import logger from '../../services/logger.js';
import { nullOrEmpty } from '../../utils.js'; import { nullOrEmpty } from '../../utils.js';
import { getJobs } from '../../services/storage/jobStorage.js'; import { getJobs } from '../../services/storage/jobStorage.js';
import { getSettings } from '../../services/storage/settingsStorage.js';
const service = restana(); const service = restana();
@@ -107,7 +108,13 @@ listingsRouter.post('/watch', async (req, res) => {
listingsRouter.delete('/job', async (req, res) => { listingsRouter.delete('/job', async (req, res) => {
const { jobId } = req.body; const { jobId } = req.body;
const settings = await getSettings();
try { try {
if (settings.demoMode) {
res.send(new Error('Sorry, but you cannot remove listings in demo mode ;)'));
return;
}
listingStorage.deleteListingsByJobId(jobId); listingStorage.deleteListingsByJobId(jobId);
} catch (error) { } catch (error) {
res.send(new Error(error)); res.send(new Error(error));

View File

@@ -1,6 +1,6 @@
{ {
"name": "fredy", "name": "fredy",
"version": "19.3.1", "version": "19.3.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": {
"prepare": "husky", "prepare": "husky",

View File

@@ -315,7 +315,7 @@ export default function ListingDetail() {
> >
{listing.isWatched === 1 ? 'Watched' : 'Watch'} {listing.isWatched === 1 ? 'Watched' : 'Watch'}
</Button> </Button>
<Text link={{ href: listing.link }} icon={<IconLink />} underline> <Text link={{ href: listing.link, target: '_blank' }} icon={<IconLink />} underline>
Open listing Open listing
</Text> </Text>
</Space> </Space>

View File

@@ -62,6 +62,18 @@ export default function Login() {
<div className="login__logoWrapper"> <div className="login__logoWrapper">
<Logo width={250} white /> <Logo width={250} white />
</div> </div>
{demoMode && (
<Banner
fullMode={true}
type="info"
bordered
closeIcon={null}
description="This is the demo version of Fredy. Use 'demo' as both the username and password to log in."
style={{ marginBottom: '1.5rem' }}
/>
)}
<form onSubmit={(e) => e.preventDefault()}> <form onSubmit={(e) => e.preventDefault()}>
{error && <Banner type="danger" closeIcon={null} description={error} style={{ marginBottom: '1rem' }} />} {error && <Banner type="danger" closeIcon={null} description={error} style={{ marginBottom: '1rem' }} />}
<div className="login__inputGroup"> <div className="login__inputGroup">
@@ -100,17 +112,6 @@ export default function Login() {
<Button block type="primary" onClick={tryLogin} theme="solid" style={{ marginTop: '1rem' }}> <Button block type="primary" onClick={tryLogin} theme="solid" style={{ marginTop: '1rem' }}>
Login Login
</Button> </Button>
{demoMode && (
<Banner
fullMode={true}
type="info"
bordered
closeIcon={null}
description="This is the demo version of Fredy. Use 'demo' as both the username and password to log in."
style={{ marginTop: '1.5rem' }}
/>
)}
</form> </form>
</div> </div>
</div> </div>