diff --git a/next.config.js b/next.config.js index 1190d54..6bbe8ab 100644 --- a/next.config.js +++ b/next.config.js @@ -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; diff --git a/pages/api/settings.ts b/pages/api/settings.ts index 3895947..7a10c3b 100644 --- a/pages/api/settings.ts +++ b/pages/api/settings.ts @@ -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'; @@ -26,7 +27,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) const getSettings = async (req: NextApiRequest, res: NextApiResponse) => { 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!' }); }; diff --git a/pages/domains/index.tsx b/pages/domains/index.tsx index 4ee70c2..f9e2b44 100644 --- a/pages/domains/index.tsx +++ b/pages/domains/index.tsx @@ -58,7 +58,7 @@ const SingleDomain: NextPage = () => { }, [appSettings]); return ( -
+
{noScrapprtError && (
A Scrapper/Proxy has not been set up Yet. Open Settings to set it up and start using the app. @@ -112,6 +112,9 @@ const SingleDomain: NextPage = () => { setShowSettings(false)} /> +
); }; diff --git a/types.d.ts b/types.d.ts index db54a7c..084b3ad 100644 --- a/types.d.ts +++ b/types.d.ts @@ -80,6 +80,7 @@ type SettingsType = { search_console_integrated?: boolean, available_scapers?: Array, scrape_interval?: string + version?: string } type KeywordSCDataChild = {