mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Merge dev.
This commit is contained in:
commit
be1b2fc272
88 changed files with 4120 additions and 21010 deletions
|
|
@ -1,11 +1,10 @@
|
|||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable no-console */
|
||||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const https = require('https');
|
||||
const zlib = require('zlib');
|
||||
const tar = require('tar');
|
||||
import 'dotenv/config';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import https from 'https';
|
||||
import zlib from 'zlib';
|
||||
import tar from 'tar';
|
||||
|
||||
if (process.env.VERCEL) {
|
||||
console.log('Vercel environment detected. Skipping geo setup.');
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
/* eslint-disable no-console */
|
||||
require('dotenv').config();
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const chalk = require('chalk');
|
||||
const { execSync } = require('child_process');
|
||||
const semver = require('semver');
|
||||
import 'dotenv/config';
|
||||
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import chalk from 'chalk';
|
||||
import { execSync } from 'child_process';
|
||||
import semver from 'semver';
|
||||
|
||||
if (process.env.SKIP_DB_CHECK) {
|
||||
console.log('Skipping database check.');
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable no-console */
|
||||
require('dotenv').config();
|
||||
import 'dotenv/config';
|
||||
|
||||
function checkMissing(vars) {
|
||||
const missing = vars.reduce((arr, key) => {
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
/* eslint-disable no-console */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const chalk = require('chalk');
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import chalk from 'chalk';
|
||||
import { createRequire } from "module";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const messages = require('../src/lang/en-US.json');
|
||||
const ignore = require('../lang-ignore.json');
|
||||
|
||||
const dir = path.resolve(__dirname, '../lang');
|
||||
const files = fs.readdirSync(dir);
|
||||
const keys = Object.keys(messages).sort();
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
/* eslint-disable no-console */
|
||||
require('dotenv').config();
|
||||
const fse = require('fs-extra');
|
||||
const path = require('path');
|
||||
const del = require('del');
|
||||
import 'dotenv/config';
|
||||
import fse from 'fs-extra';
|
||||
import path from 'node:path';
|
||||
import url from 'node:url';
|
||||
import del from 'del';
|
||||
|
||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
|
||||
function getDatabaseType(url = process.env.DATABASE_URL) {
|
||||
const type = process.env.DATABASE_TYPE || (url && url.split(':')[0]);
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
/* eslint-disable no-console, @typescript-eslint/no-var-requires */
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const https = require('https');
|
||||
const chalk = require('chalk');
|
||||
/* eslint-disable no-console */
|
||||
import fs from 'fs-extra';
|
||||
import path from 'node:path';
|
||||
import https from 'https';
|
||||
import chalk from 'chalk';
|
||||
import url from "node:url";
|
||||
|
||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
|
||||
const src = path.resolve(__dirname, '../src/lang');
|
||||
const dest = path.resolve(__dirname, '../public/intl/country');
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
/* eslint-disable no-console */
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const https = require('https');
|
||||
const chalk = require('chalk');
|
||||
import fs from 'fs-extra';
|
||||
import path from 'node:path';
|
||||
import https from 'https';
|
||||
import chalk from 'chalk';
|
||||
import url from "node:url";
|
||||
|
||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
|
||||
const src = path.resolve(__dirname, '../src/lang');
|
||||
const dest = path.resolve(__dirname, '../public/intl/language');
|
||||
|
|
@ -1,8 +1,13 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const del = require('del');
|
||||
const prettier = require('prettier');
|
||||
import path from 'node:path';
|
||||
import url from 'node:url';
|
||||
import fs from 'fs-extra';
|
||||
import del from 'del';
|
||||
import prettier from 'prettier';
|
||||
import { createRequire } from 'module';
|
||||
|
||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const src = path.resolve(__dirname, '../src/lang');
|
||||
const dest = path.resolve(__dirname, '../build/messages');
|
||||
const files = fs.readdirSync(src);
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
/* eslint-disable no-console */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const prettier = require('prettier');
|
||||
const messages = require('../build/extracted-messages.json');
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import prettier from 'prettier';
|
||||
import messages from '../build/extracted-messages.json';
|
||||
import { createRequire } from "module";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const dest = path.resolve(__dirname, '../src/lang');
|
||||
const files = fs.readdirSync(dest);
|
||||
const keys = Object.keys(messages).sort();
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
require('dotenv').config();
|
||||
const { sendTelemetry } = require('./telemetry');
|
||||
import 'dotenv/config';
|
||||
import { sendTelemetry } from './telemetry';
|
||||
|
||||
async function run() {
|
||||
if (!process.env.DISABLE_TELEMETRY) {
|
||||
74
scripts/set-routes-manifest.mjs
Normal file
74
scripts/set-routes-manifest.mjs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/* eslint-disable no-console */
|
||||
import 'dotenv/config';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const routesManifestPath = path.resolve(__dirname, '../.next/routes-manifest.json');
|
||||
const originalPath = path.resolve(__dirname, '../.next/routes-manifest-orig.json');
|
||||
const originalManifest = require(originalPath);
|
||||
|
||||
const API_PATH = '/api/:path*';
|
||||
const TRACKER_SCRIPT = '/script.js';
|
||||
|
||||
const collectApiEndpoint = process.env.COLLECT_API_ENDPOINT;
|
||||
const trackerScriptName = process.env.TRACKER_SCRIPT_NAME;
|
||||
|
||||
const headers = [];
|
||||
const rewrites = [];
|
||||
|
||||
if (collectApiEndpoint) {
|
||||
const apiRoute = originalManifest.headers.find(route => route.source === API_PATH);
|
||||
const routeRegex = new RegExp(apiRoute.regex);
|
||||
|
||||
rewrites.push({
|
||||
source: collectApiEndpoint,
|
||||
destination: '/api/send',
|
||||
});
|
||||
|
||||
if (!routeRegex.test(collectApiEndpoint)) {
|
||||
headers.push({
|
||||
source: collectApiEndpoint,
|
||||
headers: apiRoute.headers,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (trackerScriptName) {
|
||||
const trackerRoute = originalManifest.headers.find(route => route.source === TRACKER_SCRIPT);
|
||||
|
||||
const names = trackerScriptName?.split(',').map(name => name.trim());
|
||||
|
||||
if (names) {
|
||||
names.forEach(name => {
|
||||
const normalizedSource = `/${name.replace(/^\/+/, '')}`;
|
||||
|
||||
rewrites.push({
|
||||
source: normalizedSource,
|
||||
destination: TRACKER_SCRIPT,
|
||||
});
|
||||
|
||||
headers.push({
|
||||
source: normalizedSource,
|
||||
headers: trackerRoute.headers,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const routesManifest = { ...originalManifest };
|
||||
|
||||
if (rewrites.length !== 0) {
|
||||
const { buildCustomRoute } = require('next/dist/lib/build-custom-route');
|
||||
|
||||
const builtHeaders = headers.map(header => buildCustomRoute('header', header));
|
||||
const builtRewrites = rewrites.map(rewrite => buildCustomRoute('rewrite', rewrite));
|
||||
|
||||
routesManifest.headers = [...originalManifest.headers, ...builtHeaders];
|
||||
routesManifest.rewrites = [...builtRewrites, ...originalManifest.rewrites];
|
||||
|
||||
console.log('Using updated Next.js routes manifest');
|
||||
} else {
|
||||
console.log('Using original Next.js routes manifest');
|
||||
}
|
||||
|
||||
fs.writeFileSync(routesManifestPath, JSON.stringify(routesManifest, null, 2));
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
require('dotenv').config();
|
||||
const cli = require('next/dist/cli/next-start');
|
||||
import 'dotenv/config';
|
||||
import cli from 'next/dist/cli/next-start';
|
||||
|
||||
cli.nextStart({
|
||||
port: process.env.PORT || 3000,
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
const os = require('os');
|
||||
const isCI = require('is-ci');
|
||||
const pkg = require('../package.json');
|
||||
import os from 'node:os';
|
||||
import isCI from 'is-ci';
|
||||
import { createRequire } from 'module';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const pkg = require('./package.json');
|
||||
|
||||
const url = 'https://api.umami.is/v1/telemetry';
|
||||
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
/* eslint-disable no-console */
|
||||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
import 'dotenv/config';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import url from "node:url";
|
||||
|
||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
|
||||
const endPoint = process.env.COLLECT_API_ENDPOINT;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue