core: add function for checking compability with server

This commit is contained in:
Abdullah Atta
2024-08-07 15:20:45 +05:00
committed by Abdullah Atta
parent 31453dc098
commit cc3ccd041d
2 changed files with 7 additions and 0 deletions

View File

@@ -32,3 +32,4 @@ export {
type TextSlice
} from "./utils/content-block";
export { type DatabaseUpdatedEvent } from "./database";
export { isServerCompatible } from "./utils/constants";

View File

@@ -19,6 +19,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { extractHostname } from "./hostname";
const COMPATIBLE_SERVER_VERSION = 1;
export function isServerCompatible(version: number) {
return COMPATIBLE_SERVER_VERSION === version;
}
function isProduction() {
return (
process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test"