Skip to content

Commit

Permalink
feat: Adds current App version Number in Footer.
Browse files Browse the repository at this point in the history
  • Loading branch information
towfiqi committed Mar 5, 2023
1 parent 3b6d034 commit b83df5f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/** @type {import('next').NextConfig} */
const { version } = require('./package.json');

const nextConfig = {
reactStrictMode: true,
swcMinify: false,
output: 'standalone',
publicRuntimeConfig: {
version,
},
};

module.exports = nextConfig;
5 changes: 4 additions & 1 deletion pages/api/settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import Cryptr from 'cryptr';
import getConfig from 'next/config';
import { writeFile, readFile } from 'fs/promises';
import verifyUser from '../../utils/verifyUser';
import allScrapers from '../../scrapers/index';
Expand All @@ -26,7 +27,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const getSettings = async (req: NextApiRequest, res: NextApiResponse<SettingsGetResponse>) => {
const settings = await getAppSettings();
if (settings) {
return res.status(200).json({ settings });
const { publicRuntimeConfig } = getConfig();
const version = publicRuntimeConfig?.version;
return res.status(200).json({ settings: { ...settings, version } });
}
return res.status(400).json({ error: 'Error Loading Settings!' });
};
Expand Down
5 changes: 4 additions & 1 deletion pages/domains/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const SingleDomain: NextPage = () => {
}, [appSettings]);

return (
<div className="Domain ">
<div className="Domain flex flex-col min-h-screen">
{noScrapprtError && (
<div className=' p-3 bg-red-600 text-white text-sm text-center'>
A Scrapper/Proxy has not been set up Yet. Open Settings to set it up and start using the app.
Expand Down Expand Up @@ -112,6 +112,9 @@ const SingleDomain: NextPage = () => {
<CSSTransition in={showSettings} timeout={300} classNames="settings_anim" unmountOnExit mountOnEnter>
<Settings closeSettings={() => setShowSettings(false)} />
</CSSTransition>
<footer className='text-center flex flex-1 justify-center pb-5 items-end'>
<span className='text-gray-500 text-xs'><a href='https://github.com/towfiqi/serpbear' target="_blank" rel='noreferrer'>SerpBear v{appSettings?.settings?.version || '0.0.0'}</a></span>
</footer>
</div>
);
};
Expand Down
1 change: 1 addition & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ type SettingsType = {
search_console_integrated?: boolean,
available_scapers?: Array,
scrape_interval?: string
version?: string
}

type KeywordSCDataChild = {
Expand Down

0 comments on commit b83df5f

Please sign in to comment.