chore: run formatter (#145)

This commit is contained in:
Alexander Roidl
2025-07-23 08:47:26 +02:00
committed by GitHub
parent 314b1818d7
commit cca1463a68
19 changed files with 666 additions and 665 deletions

View File

@@ -25,7 +25,7 @@ if(config.demoMode){
} }
/* eslint-enable no-console */ /* eslint-enable no-console */
const fetchedProvider = await Promise.all( const fetchedProvider = await Promise.all(
provider.filter((provider) => provider.endsWith('.js')).map(async (pro) => import(`${path}/${pro}`)) provider.filter((provider) => provider.endsWith('.js')).map(async (pro) => import(`${path}/${pro}`)),
); );
handleDemoUser(); handleDemoUser();
@@ -58,5 +58,5 @@ setInterval(
} }
return exec; return exec;
})(), })(),
INTERVAL INTERVAL,
); );

View File

@@ -6,7 +6,7 @@ const adapter = await Promise.all(
fs fs
.readdirSync('./lib/notification/adapter') .readdirSync('./lib/notification/adapter')
.filter((file) => file.endsWith('.js')) .filter((file) => file.endsWith('.js'))
.map(async (integPath) => await import(`${path}/${integPath}`)) .map(async (integPath) => await import(`${path}/${integPath}`)),
); );
if (adapter.length === 0) { if (adapter.length === 0) {

View File

@@ -7,7 +7,9 @@ function nullOrEmpty(val) {
} }
function normalize(o) { function normalize(o) {
const link = nullOrEmpty(o.link) ? 'NO LINK' : `https://www.neubaukompass.de${o.link.substring(o.link.indexOf('/neubau'))}`; const link = nullOrEmpty(o.link)
? 'NO LINK'
: `https://www.neubaukompass.de${o.link.substring(o.link.indexOf('/neubau'))}`;
const id = buildHash(o.link, o.price); const id = buildHash(o.link, o.price);
return Object.assign(o, { id, link }); return Object.assign(o, { id, link });
} }

View File

@@ -66,15 +66,17 @@ export default function FredyApp() {
{settings.demoMode && ( {settings.demoMode && (
<> <>
<Banner fullMode={true} <Banner
fullMode={true}
type="info" type="info"
bordered bordered
closeIcon={null} closeIcon={null}
description="You're currently viewing the demo version of Fredy. Jobs won't scrape websites, and any changes you make will be reverted at midnight." description="You're currently viewing the demo version of Fredy. Jobs won't scrape websites, and any changes you make will be reverted at midnight."
/> />
<br /> <br />
</>)} </>
{(settings.analyticsEnabled === null && !settings.demoMode) && <TrackingModal/>} )}
{settings.analyticsEnabled === null && !settings.demoMode && <TrackingModal />}
<Switch> <Switch>
<Route name="Insufficient Permission" path={'/403'} component={InsufficientPermission} /> <Route name="Insufficient Permission" path={'/403'} component={InsufficientPermission} />
<Route name="Create new Job" path={'/jobs/new'} component={JobMutation} /> <Route name="Create new Job" path={'/jobs/new'} component={JobMutation} />

View File

@@ -23,5 +23,5 @@ root.render(
<App /> <App />
</LocaleProvider> </LocaleProvider>
</HashRouter> </HashRouter>
</Provider> </Provider>,
); );

View File

@@ -8,7 +8,7 @@ import inDevelopment from '../../services/developmentMode.js';
const saveResponse = async (analyticsEnabled) => { const saveResponse = async (analyticsEnabled) => {
await xhrPost('/api/admin/generalSettings', { await xhrPost('/api/admin/generalSettings', {
analyticsEnabled analyticsEnabled,
}); });
}; };
@@ -17,7 +17,8 @@ export default function TrackingModal() {
return null; return null;
} }
return <Modal return (
<Modal
visible={true} visible={true}
onOk={async () => { onOk={async () => {
await saveResponse(true); await saveResponse(true);
@@ -36,17 +37,20 @@ export default function TrackingModal() {
<div className="trackingModal__description"> <div className="trackingModal__description">
<p>Hey 👋</p> <p>Hey 👋</p>
<p>Fed up with popups? Yeah, me too. But this ones important, and I promise it will only appear once ;)</p> <p>Fed up with popups? Yeah, me too. But this ones important, and I promise it will only appear once ;)</p>
<p>Fredy is completely free (and will always remain free). If youd like, you can support me by donating <p>
through my GitHub, but theres absolutely no obligation to do so.</p> Fredy is completely free (and will always remain free). If youd like, you can support me by donating through
<p>However, it would be a huge my GitHub, but theres absolutely no obligation to do so.
help if youd allow me to collect some analytical data. Wait, before you click "no", let me explain. If </p>
you <p>
agree, Fredy will send a ping to my Mixpanel project each time it runs.</p> However, it would be a huge help if youd allow me to collect some analytical data. Wait, before you click
<p>The data includes: names of "no", let me explain. If you agree, Fredy will send a ping to my Mixpanel project each time it runs.
active adapters/providers, OS, architecture, Node version, and language. The information is entirely </p>
anonymous and helps me understand which adapters/providers are most frequently used.</p> <p>
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.
</p>
<p>Thanks🤘</p> <p>Thanks🤘</p>
</div> </div>
</Modal>; </Modal>
);
} }

View File

@@ -8,7 +8,14 @@ import Headline from '../../components/headline/Headline';
import { xhrPost } from '../../services/xhr'; import { xhrPost } from '../../services/xhr';
import { SegmentPart } from '../../components/segment/SegmentPart'; import { SegmentPart } from '../../components/segment/SegmentPart';
import { Banner, Toast } from '@douyinfe/semi-ui'; import { Banner, Toast } from '@douyinfe/semi-ui';
import {IconSave, IconCalendar, IconRefresh, IconSignal, IconLineChartStroked, IconSearch} from '@douyinfe/semi-icons'; import {
IconSave,
IconCalendar,
IconRefresh,
IconSignal,
IconLineChartStroked,
IconSearch,
} from '@douyinfe/semi-icons';
import './GeneralSettings.less'; import './GeneralSettings.less';
function formatFromTimestamp(ts) { function formatFromTimestamp(ts) {
@@ -97,7 +104,7 @@ const GeneralSettings = function GeneralSettings() {
to: workingHourTo, to: workingHourTo,
}, },
demoMode, demoMode,
analyticsEnabled analyticsEnabled,
}); });
} catch (exception) { } catch (exception) {
console.error(exception); console.error(exception);
@@ -175,24 +182,18 @@ const GeneralSettings = function GeneralSettings() {
</SegmentPart> </SegmentPart>
<Divider margin="1rem" /> <Divider margin="1rem" />
<SegmentPart <SegmentPart name="Analytics" helpText="Insights into the usage of Fredy." Icon={IconLineChartStroked}>
name="Analytics"
helpText="Insights into the usage of Fredy."
Icon={IconLineChartStroked}
>
<Banner <Banner
fullMode={false} fullMode={false}
type="info" type="info"
closeIcon={null} closeIcon={null}
title={ title={<div style={{ fontWeight: 600, fontSize: '14px', lineHeight: '20px' }}>Explanation</div>}
<div style={{fontWeight: 600, fontSize: '14px', lineHeight: '20px'}}>
Explanation
</div>
}
style={{ marginBottom: '1rem' }} style={{ marginBottom: '1rem' }}
description={ description={
<div> <div>
Analytics are disabled by default. If you choose to enable them, we will begin tracking the following:<br/> Analytics are disabled by default. If you choose to enable them, we will begin tracking the
following:
<br />
<ul> <ul>
<li>Name of active provider (e.g. Immoscout)</li> <li>Name of active provider (e.g. Immoscout)</li>
<li>Name of active adapter (e.g. Console)</li> <li>Name of active adapter (e.g. Console)</li>
@@ -201,35 +202,26 @@ const GeneralSettings = function GeneralSettings() {
<li>node version</li> <li>node version</li>
<li>arch</li> <li>arch</li>
</ul> </ul>
The data is sent anonymously and helps me understand which providers or adapters are being used the most. In the end it helps me to improve fredy. The data is sent anonymously and helps me understand which providers or adapters are being used the
most. In the end it helps me to improve fredy.
</div> </div>
} }
/> />
<Checkbox <Checkbox checked={analyticsEnabled} onChange={(e) => setAnalyticsEnabled(e.target.checked)}>
checked={analyticsEnabled} {' '}
onChange={(e) => setAnalyticsEnabled(e.target.checked)} Enabled
> Enabled
</Checkbox> </Checkbox>
</SegmentPart> </SegmentPart>
<Divider margin="1rem" /> <Divider margin="1rem" />
<SegmentPart <SegmentPart name="Demo Mode" helpText="If enabled, Fredy runs in demo mode." Icon={IconSearch}>
name="Demo Mode"
helpText="If enabled, Fredy runs in demo mode."
Icon={IconSearch}
>
<Banner <Banner
fullMode={false} fullMode={false}
type="info" type="info"
closeIcon={null} closeIcon={null}
title={ title={<div style={{ fontWeight: 600, fontSize: '14px', lineHeight: '20px' }}>Explanation</div>}
<div style={{fontWeight: 600, fontSize: '14px', lineHeight: '20px'}}>
Explanation
</div>
}
style={{ marginBottom: '1rem' }} style={{ marginBottom: '1rem' }}
description={ description={
<div> <div>
@@ -239,12 +231,10 @@ const GeneralSettings = function GeneralSettings() {
} }
/> />
<Checkbox <Checkbox checked={demoMode} onChange={(e) => setDemoMode(e.target.checked)}>
checked={demoMode} {' '}
onChange={(e) => setDemoMode(e.target.checked)} Enabled
> Enabled
</Checkbox> </Checkbox>
</SegmentPart> </SegmentPart>
<Divider margin="1rem" /> <Divider margin="1rem" />

View File

@@ -83,7 +83,7 @@ export default function NotificationAdapterMutator({
id: selectedAdapter.id, id: selectedAdapter.id,
name: selectedAdapter.name, name: selectedAdapter.name,
fields: selectedAdapter.fields || {}, fields: selectedAdapter.fields || {},
}) }),
); );
setSelectedAdapter(null); setSelectedAdapter(null);
@@ -114,7 +114,7 @@ export default function NotificationAdapterMutator({
setSuccessMessage('It seems like it worked! Please check your service.'); setSuccessMessage('It seems like it worked! Please check your service.');
}) })
.catch((error) => .catch((error) =>
setValidationMessage(`This did not work :-( I've received the following error: ${error.json.message}`) setValidationMessage(`This did not work :-( I've received the following error: ${error.json.message}`),
); );
}; };
@@ -229,7 +229,7 @@ export default function NotificationAdapterMutator({
.filter((option) => .filter((option) =>
editNotificationAdapter != null editNotificationAdapter != null
? true ? true
: selected.find((selectedOption) => selectedOption.id === option.key) == null : selected.find((selectedOption) => selectedOption.id === option.key) == null,
) )
.sort(sortAdapter)} .sort(sortAdapter)}
onChange={(value) => { onChange={(value) => {

View File

@@ -45,7 +45,7 @@ export default function ProviderMutator({ onVisibilityChanged, visible = false,
url: providerUrl, url: providerUrl,
id: selectedProvider.id, id: selectedProvider.id,
name: selectedProvider.name, name: selectedProvider.name,
}) }),
); );
setProviderUrl(null); setProviderUrl(null);
setSelectedProvider(null); setSelectedProvider(null);

View File

@@ -87,12 +87,15 @@ export default function Login() {
Login Login
</Button> </Button>
<br /> <br />
{demoMode && <Banner fullMode={true} {demoMode && (
<Banner
fullMode={true}
type="info" type="info"
bordered bordered
closeIcon={null} closeIcon={null}
description="This is the demo version of Fredy. Use 'demo' as both the username and password to log in." description="This is the demo version of Fredy. Use 'demo' as both the username and password to log in."
/>} />
)}
</div> </div>
</form> </form>
</div> </div>