mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-22 18:46:38 +00:00
Compare commits
20 Commits
1.16.2-s.1
...
crowdin_de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6c9046405 | ||
|
|
ea2ec84f08 | ||
|
|
40a14ac5f6 | ||
|
|
78169f087f | ||
|
|
4021107d08 | ||
|
|
e78aaeb344 | ||
|
|
0087ca997d | ||
|
|
61d4d314d6 | ||
|
|
2e8b4ddbdb | ||
|
|
3996b86f14 | ||
|
|
7388ef8588 | ||
|
|
bb2edb23e5 | ||
|
|
4cad384476 | ||
|
|
ba07eb1303 | ||
|
|
7c2b4f422a | ||
|
|
ad2a0ae127 | ||
|
|
6c2c620c99 | ||
|
|
f643abf19a | ||
|
|
a1729033cf | ||
|
|
7311766512 |
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Въведете конфигурационния токен от сървърната конзола.",
|
"setupTokenDescription": "Въведете конфигурационния токен от сървърната конзола.",
|
||||||
"setupTokenRequired": "Необходим е конфигурационен токен",
|
"setupTokenRequired": "Необходим е конфигурационен токен",
|
||||||
"actionUpdateSite": "Актуализиране на сайт",
|
"actionUpdateSite": "Актуализиране на сайт",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Изброяване на позволените роли за сайта",
|
"actionListSiteRoles": "Изброяване на позволените роли за сайта",
|
||||||
"actionCreateResource": "Създаване на ресурс",
|
"actionCreateResource": "Създаване на ресурс",
|
||||||
"actionDeleteResource": "Изтриване на ресурс",
|
"actionDeleteResource": "Изтриване на ресурс",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Zadejte nastavovací token z konzole serveru.",
|
"setupTokenDescription": "Zadejte nastavovací token z konzole serveru.",
|
||||||
"setupTokenRequired": "Je vyžadován token nastavení",
|
"setupTokenRequired": "Je vyžadován token nastavení",
|
||||||
"actionUpdateSite": "Aktualizovat stránku",
|
"actionUpdateSite": "Aktualizovat stránku",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Seznam povolených rolí webu",
|
"actionListSiteRoles": "Seznam povolených rolí webu",
|
||||||
"actionCreateResource": "Vytvořit zdroj",
|
"actionCreateResource": "Vytvořit zdroj",
|
||||||
"actionDeleteResource": "Odstranit dokument",
|
"actionDeleteResource": "Odstranit dokument",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Geben Sie das Setup-Token von der Serverkonsole ein.",
|
"setupTokenDescription": "Geben Sie das Setup-Token von der Serverkonsole ein.",
|
||||||
"setupTokenRequired": "Setup-Token ist erforderlich",
|
"setupTokenRequired": "Setup-Token ist erforderlich",
|
||||||
"actionUpdateSite": "Standorte aktualisieren",
|
"actionUpdateSite": "Standorte aktualisieren",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Erlaubte Standort-Rollen auflisten",
|
"actionListSiteRoles": "Erlaubte Standort-Rollen auflisten",
|
||||||
"actionCreateResource": "Ressource erstellen",
|
"actionCreateResource": "Ressource erstellen",
|
||||||
"actionDeleteResource": "Ressource löschen",
|
"actionDeleteResource": "Ressource löschen",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Ingrese el token de configuración desde la consola del servidor.",
|
"setupTokenDescription": "Ingrese el token de configuración desde la consola del servidor.",
|
||||||
"setupTokenRequired": "Se requiere el token de configuración",
|
"setupTokenRequired": "Se requiere el token de configuración",
|
||||||
"actionUpdateSite": "Actualizar sitio",
|
"actionUpdateSite": "Actualizar sitio",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Lista de roles permitidos del sitio",
|
"actionListSiteRoles": "Lista de roles permitidos del sitio",
|
||||||
"actionCreateResource": "Crear Recurso",
|
"actionCreateResource": "Crear Recurso",
|
||||||
"actionDeleteResource": "Eliminar Recurso",
|
"actionDeleteResource": "Eliminar Recurso",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Entrez le jeton de configuration depuis la console du serveur.",
|
"setupTokenDescription": "Entrez le jeton de configuration depuis la console du serveur.",
|
||||||
"setupTokenRequired": "Le jeton de configuration est requis.",
|
"setupTokenRequired": "Le jeton de configuration est requis.",
|
||||||
"actionUpdateSite": "Mettre à jour un site",
|
"actionUpdateSite": "Mettre à jour un site",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Lister les rôles autorisés du site",
|
"actionListSiteRoles": "Lister les rôles autorisés du site",
|
||||||
"actionCreateResource": "Créer une ressource",
|
"actionCreateResource": "Créer une ressource",
|
||||||
"actionDeleteResource": "Supprimer une ressource",
|
"actionDeleteResource": "Supprimer une ressource",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Inserisci il token di configurazione dalla console del server.",
|
"setupTokenDescription": "Inserisci il token di configurazione dalla console del server.",
|
||||||
"setupTokenRequired": "Il token di configurazione è richiesto",
|
"setupTokenRequired": "Il token di configurazione è richiesto",
|
||||||
"actionUpdateSite": "Aggiorna Sito",
|
"actionUpdateSite": "Aggiorna Sito",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Elenca Ruoli Sito Consentiti",
|
"actionListSiteRoles": "Elenca Ruoli Sito Consentiti",
|
||||||
"actionCreateResource": "Crea Risorsa",
|
"actionCreateResource": "Crea Risorsa",
|
||||||
"actionDeleteResource": "Elimina Risorsa",
|
"actionDeleteResource": "Elimina Risorsa",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "서버 콘솔에서 설정 토큰 입력.",
|
"setupTokenDescription": "서버 콘솔에서 설정 토큰 입력.",
|
||||||
"setupTokenRequired": "설정 토큰이 필요합니다",
|
"setupTokenRequired": "설정 토큰이 필요합니다",
|
||||||
"actionUpdateSite": "사이트 업데이트",
|
"actionUpdateSite": "사이트 업데이트",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "허용된 사이트 역할 목록",
|
"actionListSiteRoles": "허용된 사이트 역할 목록",
|
||||||
"actionCreateResource": "리소스 생성",
|
"actionCreateResource": "리소스 생성",
|
||||||
"actionDeleteResource": "리소스 삭제",
|
"actionDeleteResource": "리소스 삭제",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Skriv inn oppsetttoken fra serverkonsollen.",
|
"setupTokenDescription": "Skriv inn oppsetttoken fra serverkonsollen.",
|
||||||
"setupTokenRequired": "Oppsetttoken er nødvendig",
|
"setupTokenRequired": "Oppsetttoken er nødvendig",
|
||||||
"actionUpdateSite": "Oppdater område",
|
"actionUpdateSite": "Oppdater område",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "List opp tillatte områderoller",
|
"actionListSiteRoles": "List opp tillatte områderoller",
|
||||||
"actionCreateResource": "Opprett ressurs",
|
"actionCreateResource": "Opprett ressurs",
|
||||||
"actionDeleteResource": "Slett ressurs",
|
"actionDeleteResource": "Slett ressurs",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Voer het setup-token in vanaf de serverconsole.",
|
"setupTokenDescription": "Voer het setup-token in vanaf de serverconsole.",
|
||||||
"setupTokenRequired": "Setup-token is vereist",
|
"setupTokenRequired": "Setup-token is vereist",
|
||||||
"actionUpdateSite": "Site bijwerken",
|
"actionUpdateSite": "Site bijwerken",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Toon toegestane sitenollen",
|
"actionListSiteRoles": "Toon toegestane sitenollen",
|
||||||
"actionCreateResource": "Bron maken",
|
"actionCreateResource": "Bron maken",
|
||||||
"actionDeleteResource": "Document verwijderen",
|
"actionDeleteResource": "Document verwijderen",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Wprowadź token konfiguracji z konsoli serwera.",
|
"setupTokenDescription": "Wprowadź token konfiguracji z konsoli serwera.",
|
||||||
"setupTokenRequired": "Wymagany jest token konfiguracji",
|
"setupTokenRequired": "Wymagany jest token konfiguracji",
|
||||||
"actionUpdateSite": "Aktualizuj witrynę",
|
"actionUpdateSite": "Aktualizuj witrynę",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Lista dozwolonych ról witryny",
|
"actionListSiteRoles": "Lista dozwolonych ról witryny",
|
||||||
"actionCreateResource": "Utwórz zasób",
|
"actionCreateResource": "Utwórz zasób",
|
||||||
"actionDeleteResource": "Usuń zasób",
|
"actionDeleteResource": "Usuń zasób",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Digite o token de configuração do console do servidor.",
|
"setupTokenDescription": "Digite o token de configuração do console do servidor.",
|
||||||
"setupTokenRequired": "Token de configuração é necessário",
|
"setupTokenRequired": "Token de configuração é necessário",
|
||||||
"actionUpdateSite": "Atualizar Site",
|
"actionUpdateSite": "Atualizar Site",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Listar Funções Permitidas do Site",
|
"actionListSiteRoles": "Listar Funções Permitidas do Site",
|
||||||
"actionCreateResource": "Criar Recurso",
|
"actionCreateResource": "Criar Recurso",
|
||||||
"actionDeleteResource": "Eliminar Recurso",
|
"actionDeleteResource": "Eliminar Recurso",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Введите токен настройки из консоли сервера.",
|
"setupTokenDescription": "Введите токен настройки из консоли сервера.",
|
||||||
"setupTokenRequired": "Токен настройки обязателен",
|
"setupTokenRequired": "Токен настройки обязателен",
|
||||||
"actionUpdateSite": "Обновить сайт",
|
"actionUpdateSite": "Обновить сайт",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "Список разрешенных ролей сайта",
|
"actionListSiteRoles": "Список разрешенных ролей сайта",
|
||||||
"actionCreateResource": "Создать ресурс",
|
"actionCreateResource": "Создать ресурс",
|
||||||
"actionDeleteResource": "Удалить ресурс",
|
"actionDeleteResource": "Удалить ресурс",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "Sunucu konsolundan kurulum simgesini girin.",
|
"setupTokenDescription": "Sunucu konsolundan kurulum simgesini girin.",
|
||||||
"setupTokenRequired": "Kurulum simgesi gerekli",
|
"setupTokenRequired": "Kurulum simgesi gerekli",
|
||||||
"actionUpdateSite": "Siteyi Güncelle",
|
"actionUpdateSite": "Siteyi Güncelle",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "İzin Verilen Site Rolleri Listele",
|
"actionListSiteRoles": "İzin Verilen Site Rolleri Listele",
|
||||||
"actionCreateResource": "Kaynak Oluştur",
|
"actionCreateResource": "Kaynak Oluştur",
|
||||||
"actionDeleteResource": "Kaynağı Sil",
|
"actionDeleteResource": "Kaynağı Sil",
|
||||||
|
|||||||
@@ -1119,6 +1119,7 @@
|
|||||||
"setupTokenDescription": "从服务器控制台输入设置令牌。",
|
"setupTokenDescription": "从服务器控制台输入设置令牌。",
|
||||||
"setupTokenRequired": "需要设置令牌",
|
"setupTokenRequired": "需要设置令牌",
|
||||||
"actionUpdateSite": "更新站点",
|
"actionUpdateSite": "更新站点",
|
||||||
|
"actionResetSiteBandwidth": "Reset Organization Bandwidth",
|
||||||
"actionListSiteRoles": "允许站点角色列表",
|
"actionListSiteRoles": "允许站点角色列表",
|
||||||
"actionCreateResource": "创建资源",
|
"actionCreateResource": "创建资源",
|
||||||
"actionDeleteResource": "删除资源",
|
"actionDeleteResource": "删除资源",
|
||||||
|
|||||||
@@ -24,23 +24,31 @@ setInterval(() => {
|
|||||||
*/
|
*/
|
||||||
class AdaptiveCache {
|
class AdaptiveCache {
|
||||||
private useRedis(): boolean {
|
private useRedis(): boolean {
|
||||||
return redisManager.isRedisEnabled() && redisManager.getHealthStatus().isHealthy;
|
return (
|
||||||
|
redisManager.isRedisEnabled() &&
|
||||||
|
redisManager.getHealthStatus().isHealthy
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a value in the cache
|
* Set a value in the cache
|
||||||
* @param key - Cache key
|
* @param key - Cache key
|
||||||
* @param value - Value to cache (will be JSON stringified for Redis)
|
* @param value - Value to cache (will be JSON stringified for Redis)
|
||||||
* @param ttl - Time to live in seconds (0 = no expiration)
|
* @param ttl - Time to live in seconds (0 = no expiration; omit = 3600s for Redis)
|
||||||
* @returns boolean indicating success
|
* @returns boolean indicating success
|
||||||
*/
|
*/
|
||||||
async set(key: string, value: any, ttl?: number): Promise<boolean> {
|
async set(key: string, value: any, ttl?: number): Promise<boolean> {
|
||||||
const effectiveTtl = ttl === 0 ? undefined : ttl;
|
const effectiveTtl = ttl === 0 ? undefined : ttl;
|
||||||
|
const redisTtl = ttl === 0 ? undefined : (ttl ?? 3600);
|
||||||
|
|
||||||
if (this.useRedis()) {
|
if (this.useRedis()) {
|
||||||
try {
|
try {
|
||||||
const serialized = JSON.stringify(value);
|
const serialized = JSON.stringify(value);
|
||||||
const success = await redisManager.set(key, serialized, effectiveTtl);
|
const success = await redisManager.set(
|
||||||
|
key,
|
||||||
|
serialized,
|
||||||
|
redisTtl
|
||||||
|
);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
logger.debug(`Set key in Redis: ${key}`);
|
logger.debug(`Set key in Redis: ${key}`);
|
||||||
@@ -48,7 +56,9 @@ class AdaptiveCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Redis failed, fall through to local cache
|
// Redis failed, fall through to local cache
|
||||||
logger.debug(`Redis set failed for key ${key}, falling back to local cache`);
|
logger.debug(
|
||||||
|
`Redis set failed for key ${key}, falling back to local cache`
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Redis set error for key ${key}:`, error);
|
logger.error(`Redis set error for key ${key}:`, error);
|
||||||
// Fall through to local cache
|
// Fall through to local cache
|
||||||
@@ -120,9 +130,14 @@ class AdaptiveCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Some Redis deletes failed, fall through to local cache
|
// Some Redis deletes failed, fall through to local cache
|
||||||
logger.debug(`Some Redis deletes failed, falling back to local cache`);
|
logger.debug(
|
||||||
|
`Some Redis deletes failed, falling back to local cache`
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Redis del error for keys ${keys.join(", ")}:`, error);
|
logger.error(
|
||||||
|
`Redis del error for keys ${keys.join(", ")}:`,
|
||||||
|
error
|
||||||
|
);
|
||||||
// Fall through to local cache
|
// Fall through to local cache
|
||||||
deletedCount = 0;
|
deletedCount = 0;
|
||||||
}
|
}
|
||||||
@@ -195,7 +210,9 @@ class AdaptiveCache {
|
|||||||
*/
|
*/
|
||||||
async flushAll(): Promise<void> {
|
async flushAll(): Promise<void> {
|
||||||
if (this.useRedis()) {
|
if (this.useRedis()) {
|
||||||
logger.warn("Adaptive cache flushAll called - Redis flush not implemented, only local cache will be flushed");
|
logger.warn(
|
||||||
|
"Adaptive cache flushAll called - Redis flush not implemented, only local cache will be flushed"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
localCache.flushAll();
|
localCache.flushAll();
|
||||||
@@ -239,7 +256,9 @@ class AdaptiveCache {
|
|||||||
getTtl(key: string): number {
|
getTtl(key: string): number {
|
||||||
// Note: This only works for local cache, Redis TTL is not supported
|
// Note: This only works for local cache, Redis TTL is not supported
|
||||||
if (this.useRedis()) {
|
if (this.useRedis()) {
|
||||||
logger.warn(`getTtl called for key ${key} but Redis TTL lookup is not implemented`);
|
logger.warn(
|
||||||
|
`getTtl called for key ${key} but Redis TTL lookup is not implemented`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ttl = localCache.getTtl(key);
|
const ttl = localCache.getTtl(key);
|
||||||
@@ -255,7 +274,9 @@ class AdaptiveCache {
|
|||||||
*/
|
*/
|
||||||
keys(): string[] {
|
keys(): string[] {
|
||||||
if (this.useRedis()) {
|
if (this.useRedis()) {
|
||||||
logger.warn("keys() called but Redis keys are not included, only local cache keys returned");
|
logger.warn(
|
||||||
|
"keys() called but Redis keys are not included, only local cache keys returned"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return localCache.keys();
|
return localCache.keys();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { verifySessionRemoteExitNodeMiddleware } from "#private/middlewares/veri
|
|||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
import {
|
import {
|
||||||
db,
|
db,
|
||||||
|
logsDb,
|
||||||
exitNodes,
|
exitNodes,
|
||||||
Resource,
|
Resource,
|
||||||
ResourcePassword,
|
ResourcePassword,
|
||||||
@@ -1885,7 +1886,7 @@ hybridRouter.post(
|
|||||||
const batchSize = 100;
|
const batchSize = 100;
|
||||||
for (let i = 0; i < logEntries.length; i += batchSize) {
|
for (let i = 0; i < logEntries.length; i += batchSize) {
|
||||||
const batch = logEntries.slice(i, i + batchSize);
|
const batch = logEntries.slice(i, i + batchSize);
|
||||||
await db.insert(requestAuditLog).values(batch);
|
await logsDb.insert(requestAuditLog).values(batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response(res, {
|
return response(res, {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export const startRemoteExitNodeOfflineChecker = (): void => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Find clients that haven't pinged in the last 2 minutes and mark them as offline
|
// Find clients that haven't pinged in the last 2 minutes and mark them as offline
|
||||||
const newlyOfflineNodes = await db
|
const offlineNodes = await db
|
||||||
.update(exitNodes)
|
.update(exitNodes)
|
||||||
.set({ online: false })
|
.set({ online: false })
|
||||||
.where(
|
.where(
|
||||||
@@ -53,32 +53,15 @@ export const startRemoteExitNodeOfflineChecker = (): void => {
|
|||||||
)
|
)
|
||||||
.returning();
|
.returning();
|
||||||
|
|
||||||
// Update the sites to offline if they have not pinged either
|
if (offlineNodes.length > 0) {
|
||||||
const exitNodeIds = newlyOfflineNodes.map(
|
logger.info(
|
||||||
(node) => node.exitNodeId
|
`checkRemoteExitNodeOffline: Marked ${offlineNodes.length} remoteExitNode client(s) offline due to inactivity`
|
||||||
);
|
|
||||||
|
|
||||||
const sitesOnNode = await db
|
|
||||||
.select()
|
|
||||||
.from(sites)
|
|
||||||
.where(
|
|
||||||
and(
|
|
||||||
eq(sites.online, true),
|
|
||||||
inArray(sites.exitNodeId, exitNodeIds)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// loop through the sites and process their lastBandwidthUpdate as an iso string and if its more than 1 minute old then mark the site offline
|
for (const offlineClient of offlineNodes) {
|
||||||
for (const site of sitesOnNode) {
|
logger.debug(
|
||||||
if (!site.lastBandwidthUpdate) {
|
`checkRemoteExitNodeOffline: Client ${offlineClient.exitNodeId} marked offline (lastPing: ${offlineClient.lastPing})`
|
||||||
continue;
|
);
|
||||||
}
|
|
||||||
const lastBandwidthUpdate = new Date(site.lastBandwidthUpdate);
|
|
||||||
if (Date.now() - lastBandwidthUpdate.getTime() > 60 * 1000) {
|
|
||||||
await db
|
|
||||||
.update(sites)
|
|
||||||
.set({ online: false })
|
|
||||||
.where(eq(sites.siteId, site.siteId));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ async function getLatestOlmVersion(): Promise<string | null> {
|
|||||||
tags = tags.filter((version) => !version.name.includes("rc"));
|
tags = tags.filter((version) => !version.name.includes("rc"));
|
||||||
const latestVersion = tags[0].name;
|
const latestVersion = tags[0].name;
|
||||||
|
|
||||||
olmVersionCache.set("latestOlmVersion", latestVersion);
|
olmVersionCache.set("latestOlmVersion", latestVersion, 3600);
|
||||||
|
|
||||||
return latestVersion;
|
return latestVersion;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ async function getLatestOlmVersion(): Promise<string | null> {
|
|||||||
tags = tags.filter((version) => !version.name.includes("rc"));
|
tags = tags.filter((version) => !version.name.includes("rc"));
|
||||||
const latestVersion = tags[0].name;
|
const latestVersion = tags[0].name;
|
||||||
|
|
||||||
olmVersionCache.set("latestOlmVersion", latestVersion);
|
olmVersionCache.set("latestOlmVersion", latestVersion, 3600);
|
||||||
|
|
||||||
return latestVersion;
|
return latestVersion;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import logger from "@server/logger";
|
|||||||
/**
|
/**
|
||||||
* Handles disconnecting messages from sites to show disconnected in the ui
|
* Handles disconnecting messages from sites to show disconnected in the ui
|
||||||
*/
|
*/
|
||||||
export const handleNewtDisconnectingMessage: MessageHandler = async (context) => {
|
export const handleNewtDisconnectingMessage: MessageHandler = async (
|
||||||
|
context
|
||||||
|
) => {
|
||||||
const { message, client: c, sendToClient } = context;
|
const { message, client: c, sendToClient } = context;
|
||||||
const newt = c as Newt;
|
const newt = c as Newt;
|
||||||
|
|
||||||
@@ -27,7 +29,7 @@ export const handleNewtDisconnectingMessage: MessageHandler = async (context) =>
|
|||||||
.set({
|
.set({
|
||||||
online: false
|
online: false
|
||||||
})
|
})
|
||||||
.where(eq(sites.siteId, sites.siteId));
|
.where(eq(sites.siteId, newt.siteId));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error("Error handling disconnecting message", { error });
|
logger.error("Error handling disconnecting message", { error });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ async function getLatestNewtVersion(): Promise<string | null> {
|
|||||||
tags = tags.filter((version) => !version.name.includes("rc"));
|
tags = tags.filter((version) => !version.name.includes("rc"));
|
||||||
const latestVersion = tags[0].name;
|
const latestVersion = tags[0].name;
|
||||||
|
|
||||||
await cache.set("latestNewtVersion", latestVersion);
|
await cache.set("latestNewtVersion", latestVersion, 3600);
|
||||||
|
|
||||||
return latestVersion;
|
return latestVersion;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
@@ -180,7 +180,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/sites",
|
path: "/org/{orgId}/sites",
|
||||||
description: "List all sites in an organization",
|
description: "List all sites in an organization",
|
||||||
tags: [OpenAPITags.Site],
|
tags: [OpenAPITags.Org, OpenAPITags.Site],
|
||||||
request: {
|
request: {
|
||||||
params: listSitesParamsSchema,
|
params: listSitesParamsSchema,
|
||||||
query: listSitesSchema
|
query: listSitesSchema
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ export async function inviteUser(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await cache.set(email, attempts + 1);
|
await cache.set("regenerateInvite:" + email, attempts + 1, 3600);
|
||||||
|
|
||||||
const inviteId = existingInvite[0].inviteId; // Retrieve the original inviteId
|
const inviteId = existingInvite[0].inviteId; // Retrieve the original inviteId
|
||||||
const token = generateRandomString(
|
const token = generateRandomString(
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import { usePathname, useRouter } from "next/navigation";
|
|||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { useUserContext } from "@app/hooks/useUserContext";
|
import { useUserContext } from "@app/hooks/useUserContext";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
import { build } from "@server/build";
|
||||||
|
|
||||||
interface OrgSelectorProps {
|
interface OrgSelectorProps {
|
||||||
orgId?: string;
|
orgId?: string;
|
||||||
@@ -50,6 +51,11 @@ export function OrgSelector({
|
|||||||
|
|
||||||
const selectedOrg = orgs?.find((org) => org.orgId === orgId);
|
const selectedOrg = orgs?.find((org) => org.orgId === orgId);
|
||||||
|
|
||||||
|
let canCreateOrg = !env.flags.disableUserCreateOrg || user.serverAdmin;
|
||||||
|
if (build === "saas" && user.type !== "internal") {
|
||||||
|
canCreateOrg = false;
|
||||||
|
}
|
||||||
|
|
||||||
const sortedOrgs = useMemo(() => {
|
const sortedOrgs = useMemo(() => {
|
||||||
if (!orgs?.length) return orgs ?? [];
|
if (!orgs?.length) return orgs ?? [];
|
||||||
return [...orgs].sort((a, b) => {
|
return [...orgs].sort((a, b) => {
|
||||||
@@ -161,7 +167,7 @@ export function OrgSelector({
|
|||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
</CommandList>
|
</CommandList>
|
||||||
</Command>
|
</Command>
|
||||||
{(!env.flags.disableUserCreateOrg || user.serverAdmin) && (
|
{canCreateOrg && (
|
||||||
<div className="p-2 border-t border-border">
|
<div className="p-2 border-t border-border">
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
Reference in New Issue
Block a user