fix adding channels for languages

add pt translations
fix ru translations
This commit is contained in:
HF 2021-01-31 19:14:19 +01:00
parent acf353619f
commit 4ca75a586a
10 changed files with 1650 additions and 44 deletions

1158
i18n/pt.po Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,18 @@
# PPF, 2021.
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<"
"=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Language-Team: \n"
"PO-Revision-Date: 2021-01-31 19:06+0200\n"
"Language-Team: Latvian <kde-i18n-doc@kde.org>\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"Last-Translator: \n"
"Language: ru\n"
"X-Generator: Lokalize 20.12.1\n"
"Last-Translator: PPF\n"
"Language: ru_RU\n"
#: src/components/CoordinatesBox.jsx:37 src/controls/keypress.js:59
msgid "Copied!"
@ -23,7 +24,8 @@ msgstr "Ошибка :("
#: src/ui/placePixel.js:54
msgid "Didn't get an answer from pixelplanet. Maybe try to refresh?"
msgstr "Нету ответа от пиксельпланет. Может попробуете перезагрузить страницу?"
msgstr ""
"Нету ответа от пиксельпланеты. Может попробуете перезагрузить страницу?"
#: src/ui/placePixel.js:56 src/ui/placePixel.js:265
msgid "OK"
@ -215,7 +217,8 @@ msgstr "ваш IP"
#: src/components/HelpModal.jsx:46
msgid "Place color pixels on a large canvas with other players online!"
msgstr "Ставьте цветные пиксели на огромном полотне с другими людьми по сети!"
msgstr ""
"Ставьте цветные пиксели на огромном полотне с другими игроками по сети!"
#: src/components/HelpModal.jsx:47
msgid ""
@ -227,7 +230,7 @@ msgid ""
"already set pixels."
msgstr ""
"Наше главное полотно - огромная карта мира, вы можете ставить где хотите, но "
"вам нужно ждать особую Перезарядку между поставленными пикселями.Вы можете "
"вам нужно ждать особую Перезарядку между поставленными пикселями. Вы можете "
"проверить перезарядку и требования в Меню выбора полотен(кнопка с глобусом "
"наверху). Некоторые полотна имеют разную перезарядку для замены пикселей уже "
"поставленных пользователями и для нетронутых пикселей.т.е. 4с/7с значит что "
@ -267,7 +270,7 @@ msgstr ""
#: src/components/HelpModal.jsx:59
msgid "Detected as Proxy?"
msgstr "Вы были обнаружены как использующий прокси?"
msgstr "Вас распознали как Прокси?"
#: src/components/HelpModal.jsx:61
#, javascript-format
@ -296,9 +299,7 @@ msgstr "Нажмите ${ bindG } чтобы переключить исполь
#: src/components/HelpModal.jsx:67
msgid "Press ${ bindX } to toggle showing of pixel activity"
msgstr ""
"Нажмите ${ bindX } чтобы переключить отображение активности постановки "
"пикселей"
msgstr "Нажмите ${ bindX }, чтобы переключить отображение активности пикселей."
#: src/components/HelpModal.jsx:68
#, javascript-format
@ -442,7 +443,7 @@ msgstr "Включите решётку чтобы подсветить гран
#: src/components/SettingsModal.jsx:130
msgid "Show Pixel Activity"
msgstr "Показать активность постановки пикселей"
msgstr "Показать активность пикселей"
#: src/components/SettingsModal.jsx:131
msgid "Show circles where pixels are placed."
@ -458,7 +459,7 @@ msgstr "Все звуковые эффекты будут отключены."
#: src/components/SettingsModal.jsx:145
msgid "Enable chat notifications"
msgstr "Включить уведомления в чате"
msgstr "Включить уведомления чата"
#: src/components/SettingsModal.jsx:146
msgid "Play a sound when new chat messages arrive"
@ -466,7 +467,7 @@ msgstr "Произвести звук когда в чате появляетс
#: src/components/SettingsModal.jsx:151
msgid "Auto Zoom In"
msgstr "Автоматическое увеличение приближения"
msgstr "Автоматическое приближение"
#: src/components/SettingsModal.jsx:153
msgid ""
@ -483,7 +484,7 @@ msgstr "Компактная Палитра"
#: src/components/SettingsModal.jsx:160
msgid "Display Palette in a compact form that takes less screen space."
msgstr ""
"Отображает Палитру в компактной форме чтобы занимать меньше места на экране."
"Отобразить Палитру в компактной форме чтобы занимать меньше места на экране."
#: src/components/SettingsModal.jsx:165
msgid "Potato Mode"
@ -637,8 +638,8 @@ msgid ""
"palettes, cooldown and requirements. Archive of closed canvases can be "
"accessed here:"
msgstr ""
"Выберите полотно которое вы хотите использовать. Каждое полотно имеет "
"уникальные и разные палитры, перезарядки и требования. Доступ к архиву "
"Выберите полотно которое вы хотите использовать. Каждое полотно уникальное и"
" имеет разные палитры, перезарядки и требования. Доступ к архиву "
"закрытых полотен может быть получен здесь:"
#: src/components/CanvasSelectModal.jsx:37
@ -691,7 +692,7 @@ msgstr "Поставленных Пикселей"
#: src/components/UserArea.jsx:70
msgid "Total Rank"
msgstr "Суммарный Рейтинг"
msgstr "Общий рейтинг"
#: src/components/UserArea.jsx:75
#, javascript-format
@ -851,7 +852,7 @@ msgstr "Действия с IP"
#: src/components/Admintools.jsx:470
msgid "Do stuff with IPs (one IP per line)"
msgstr "Сделать что-то с IP (одно IP за линию)"
msgstr "Сделать что-то с IP (один IP за линию)"
#: src/components/Admintools.jsx:510
msgid "Manage Moderators"

427
i18n/ssr-pt.po Normal file
View File

@ -0,0 +1,427 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"Last-Translator: \n"
"Language: pt_BR\n"
#: src/core/ChatProvider.js:243
msgid "You can not send chat messages with proxy"
msgstr "Você não pode enviar mensagens no bate-papo com um proxy"
#: src/core/ChatProvider.js:248
msgid "Couldn't send your message, pls log out and back in again."
msgstr ""
"Não consegui enviar sua mensagem, pfv saia e entre na sua conta de novo."
#: src/core/ChatProvider.js:262
#, javascript-format
msgid "You are sending messages too fast, you have to wait ${ waitTime }s :("
msgstr ""
"Você está mandando mensagens rapidamente, você tem que esperar ${ waitTime }"
"s :("
#: src/core/ChatProvider.js:266
msgid "You don't have access to this channel"
msgstr "Você não tem acesso a esse canal"
#: src/core/ChatProvider.js:282
msgid "Your mail has to be verified in order to chat"
msgstr "Você precisa verificar seu e-mail para falar no bate-papo"
#: src/core/ChatProvider.js:287
msgid "You are permanently muted, join our guilded to apppeal the mute"
msgstr ""
"Você foi silenciado para sempre, entre no nosso Guilded para pedir um "
"recurso sobre seu silenciamento"
#: src/core/ChatProvider.js:292
#, javascript-format
msgid "You are muted for another ${ timeMin } minutes"
msgstr "Você está silenciado por mais ${ timeMin } minutos"
#: src/core/ChatProvider.js:294
msgid "You are muted for another ${ muted } seconds"
msgstr "Você está silenciado por mais ${ muted } segundos"
#: src/core/ChatProvider.js:302
msgid "Ow no! Spam protection decided to mute you"
msgstr "Oloco! A proteção de spam decidiu te silenciar"
#: src/core/ChatProvider.js:313
msgid "You can't send a message this long :("
msgstr "Você não pode mandar mensagens tão grandes :("
#: src/core/ChatProvider.js:317
msgid "Please use int channel"
msgstr "Por favor use o canal internacional"
#: src/core/ChatProvider.js:321
msgid "Your country is temporary muted from chat"
msgstr "Seu país está silenciado temporariamente no bate-papo"
#: src/core/ChatProvider.js:329
msgid "Stop flooding."
msgstr "Pare de floodar."
#: src/ssr-components/Main.jsx:53
msgid "PixelPlanet.fun"
msgstr "PixelPlanet.fun"
#: src/ssr-components/Main.jsx:55
msgid "Place color pixels on an map styled canvas with other players online"
msgstr ""
"Coloque píxeis coloridos em um canvas com formato de mapa com outros "
"jogadores online"
#: src/ssr-components/Globe.jsx:44
msgid "Double click on globe to go back."
msgstr "Clique duas vezes no globo para voltar."
#: src/ssr-components/Globe.jsx:45
msgid "Loading..."
msgstr "Carregando..."
#: src/ssr-components/Globe.jsx:51
msgid "PixelPlanet.Fun 3DGlobe"
msgstr "PixelPlanet.Fun Globo3D"
#: src/ssr-components/Globe.jsx:52
msgid "A 3D globe of our whole map"
msgstr "Um globo 3D do nosso mapa"
#: src/routes/reset_password.js:65
msgid "You sent an empty password or invalid data :("
msgstr "Você enviou uma senha vazia ou dados inválidos :("
#: src/routes/reset_password.js:77
msgid "This password-reset link isn't valid anymore :("
msgstr "O link para trocar a senha não é mais valido :("
#: src/routes/reset_password.js:88
msgid "Your passwords do not match :("
msgstr "Suas senhas não são iguais :("
#: src/routes/reset_password.js:103
msgid "User doesn't exist in our database :("
msgstr "Usuário não existe em nosso banco de dados :("
#: src/routes/reset_password.js:115
msgid "Passowrd successfully changed."
msgstr "Senha trocada com sucesso."
#: src/routes/reset_password.js:134
msgid "Invalid url :( Please check your mail again."
msgstr "URL inválido :( Por favor, olhe seu email de novo."
#: src/routes/reset_password.js:147
msgid ""
"This passwort reset link is wrong or already expired, please request a new "
"one (Note: you can use those links just once)"
msgstr ""
"O link para trocar a senha está errado ou já expirou, por favor peça um novo "
"(Aviso: você só pode pedir o link apenas uma vez)"
#: src/core/mail.js:65
#, javascript-format
msgid ""
"We already sent you a verification mail, you can request another one in "
"${ minLeft } minutes."
msgstr ""
"Nós já te enviamos um e-mail de verificação, você pode pedir outro em "
"${ minLeft } minutos."
#: src/core/mail.js:75
msgid "Welcome ${ name } to PixelPlanet, plese verify your mail"
msgstr "Bem-vindo ${ name } ao PixelPlanet, por favor verifique seu e-mail"
#: src/core/mail.js:77
#, javascript-format
msgid "Hello ${ name }"
msgstr "Olá ${ name }"
#: src/core/mail.js:78
msgid ""
"welcome to our little community of pixelplacers, to use your account, you "
"have to verify your mail. You can do that here: "
msgstr ""
"bem-vindo à nossa comunidade de colocadores de píxeis, para usar sua conta, "
"você deve verificar seu e-mail. Você pode fazer isso aqui: "
#: src/core/mail.js:78
msgid "Click to Verify"
msgstr "Clique para verificar"
#: src/core/mail.js:78 src/core/mail.js:128
msgid "Or by copying following url:"
msgstr "Ou copiando o seguinte URL:"
#: src/core/mail.js:79
msgid ""
"Have fun and don't hesitate to contact us if you encouter any problems :)"
msgstr "Se divirta e não hesite para nos contar se encontrar algum problema :)"
#: src/core/mail.js:80 src/core/mail.js:130
msgid "Thanks"
msgstr "Obrigado"
#: src/core/mail.js:98
msgid ""
"We already sent you a mail with instructions. Please wait before requesting "
"another mail."
msgstr ""
"Nós já te enviamos um e-mail com as instruções. Por favor espere para pedir "
"um outro e-mail."
#: src/core/mail.js:106
msgid "Couldn't find this mail in our database"
msgstr "Não conseguimos achar esse e-mail no nosso banco de dados"
#: src/core/mail.js:125
msgid "You forgot your password for PixelPlanet? Get a new one here"
msgstr "Você esqueceu sua senha do PixelPlanet? Pegue uma nova aqui"
#: src/core/mail.js:127
msgid "Hello"
msgstr "Olá"
#: src/core/mail.js:128
msgid ""
"You requested to get a new password. You can change your password within the "
"next 30min here: "
msgstr ""
"Você pediu para pegar uma nova senha. Você pode trocar sua senha nos "
"próximos 30 minutos aqui: "
#: src/core/mail.js:128 src/ssr-components/PasswordReset.jsx:19
#: src/ssr-components/PasswordReset.jsx:28
msgid "Reset Password"
msgstr "Trocar Senha"
#: src/core/mail.js:129
#, javascript-format
msgid ""
"If you did not request this mail, please just ignore it (the ip that "
"requested this mail was ${ ip })."
msgstr ""
"Se você não pediu esse e-mail, por favor ignore-o (o IP que pediu esse e-"
"mail foi ${ ip })."
#: src/ssr-components/PasswordReset.jsx:21
#: src/ssr-components/RedirectionPage.jsx:15
msgid "Click here"
msgstr "Clique aqui"
#: src/ssr-components/PasswordReset.jsx:22
msgid "to go back to pixelplanet"
msgstr "para voltar para o pixelplanet"
#: src/ssr-components/PasswordReset.jsx:29
#, javascript-format
msgid "Hello ${ name }, you can set your new password here:"
msgstr "Olá ${ name }, você pode definir sua senha nova aqui:"
#: src/ssr-components/PasswordReset.jsx:33
msgid "New Password"
msgstr "Nova senha"
#: src/ssr-components/PasswordReset.jsx:41
msgid "Confirm New Password"
msgstr "Confirme a senha nova"
#: src/ssr-components/PasswordReset.jsx:47
msgid "Submit"
msgstr "Envie"
#: src/ssr-components/PasswordReset.jsx:52
msgid "PixelPlanet.fun Password Reset"
msgstr "PixelPlanet.fun Troca de Senha"
#: src/ssr-components/PasswordReset.jsx:53
msgid "Reset your password here"
msgstr "Troque sua senha aqui"
#: src/utils/validation.js:18
msgid "Email can't be empty."
msgstr "E-mail não pode ser vazio."
#: src/utils/validation.js:19
msgid "Email should be at least 5 characters long."
msgstr "E-mail deve ter ao menos 5 caracteres."
#: src/utils/validation.js:20
msgid "Email can't be longer than 40 characters."
msgstr "E-mail não pode ser maior que 40 caracteres."
#: src/utils/validation.js:21
msgid "Email should at least contain a dot"
msgstr "E-mail deve conter pelo menos um ponto"
#: src/utils/validation.js:23
msgid "Email should contain a @"
msgstr "E-mail deve conter um @"
#: src/utils/validation.js:30
msgid "Name can't be empty."
msgstr "Nome não pode ser vazio."
#: src/utils/validation.js:31
msgid "Name must be at least 4 characters long"
msgstr "Nome deve ter ao menos 4 caracteres"
#: src/utils/validation.js:32
msgid "Name must be shorter than 26 characters"
msgstr "Nome deve ser menor que 26 caracteres"
#: src/utils/validation.js:39
msgid "Name contains invalid character like @, /, \\ or #"
msgstr "Nome contém caractere invalido como @, /, \\ ou #"
#: src/utils/validation.js:54
msgid "No password given."
msgstr "Nenhuma senha fornecida."
#: src/utils/validation.js:57
msgid "Password must be at least 6 characters long."
msgstr "Senha deve ter ao menos 6 caracteres."
#: src/utils/validation.js:60
msgid "Password must be shorter than 60 characters."
msgstr "Senha deve ser menor que 60 caracteres."
#: src/utils/validation.js:74
msgid "Could not connect to server, please try again later :("
msgstr "Não consegui conectar ao servidor, por favor tente mais tarde :("
#: src/utils/validation.js:80
msgid "I think we experienced some error :("
msgstr "Acho que experenciamos algum erro :("
#: src/routes/api/auth/change_mail.js:41
#: src/routes/api/auth/change_passwd.js:37
#: src/routes/api/auth/delete_account.js:38
msgid "You are not authenticated."
msgstr "Você não está autenticado."
#: src/routes/api/auth/change_mail.js:50
#: src/routes/api/auth/change_passwd.js:46
#: src/routes/api/auth/delete_account.js:48
msgid "Incorrect password!"
msgstr "Senha errada!"
#: src/routes/api/auth/logout.js:13
msgid "You are not even logged in."
msgstr "Você não está logado."
#: src/routes/api/auth/register.js:31
msgid "E-Mail already in use."
msgstr "E-Mail já está em uso."
#: src/routes/api/auth/register.js:33
msgid "Username already in use."
msgstr "Nome de usuário já em uso."
#: src/routes/api/auth/register.js:61
msgid "Failed to create new user :("
msgstr "Falhei ao criar novo usuário :("
#: src/routes/api/auth/register.js:77
msgid "Failed to establish session after register :("
msgstr "Falhei ao estabelecer sessão após registrar :("
#: src/routes/api/auth/verify.js:25 src/routes/api/auth/verify.js:32
msgid "Mail verification"
msgstr "Verificação de e-mail"
#: src/routes/api/auth/verify.js:26
msgid "You are now verified :)"
msgstr "Agora você é verificado :)"
#: src/routes/api/auth/verify.js:32
msgid ""
"Your mail verification code is invalid or already expired :(, please request "
"a new one."
msgstr ""
"Seu código de verificação é inválido ou já expirou :(, por favor peça um "
"novo."
#: src/ssr-components/RedirectionPage.jsx:20
msgid "You will be automatically redirected after 15s"
msgstr "Você vai ser redirecionado automaticamente em 15 segundos"
#: src/ssr-components/RedirectionPage.jsx:21
#, javascript-format
msgid "Or ${ clickHere } to go back to pixelplanet"
msgstr "Ou ${ clickHere } para voltar ao pixelplanet"
#: src/ssr-components/RedirectionPage.jsx:25
msgid "PixelPlanet.fun Accounts"
msgstr "Contas do PixelPlanet.fun"
#: src/canvasesDesc.js:19
msgid "Earth"
msgstr "Terra"
#: src/canvasesDesc.js:20
msgid "Moon"
msgstr "Lua"
#: src/canvasesDesc.js:21
msgid "3D Canvas"
msgstr "Canvas 3D"
#: src/canvasesDesc.js:22
msgid "Coronavirus"
msgstr "Coronavirus"
#: src/canvasesDesc.js:23
msgid "PixelZone"
msgstr "PixelZone"
#: src/canvasesDesc.js:24
msgid "PixelCanvas"
msgstr "PixelCanvas"
#: src/canvasesDesc.js:25
msgid "1bit"
msgstr "1bit"
#: src/canvasesDesc.js:28
msgid "Our main canvas, a huge map of the world. Place everywhere you like"
msgstr ""
"Nosso canvas principal, um mapa gigante da Terra. Coloque píxeis onde você "
"quiser"
#: src/canvasesDesc.js:29
msgid ""
"Moon canvas. Safe space for art. No flags or large text (unless part of art)"
msgstr ""
"Canvas da Lua. Espaço seguro para artes. Sem bandeiras ou grandes textos (a "
"não ser que faça parte da arte)"
#: src/canvasesDesc.js:30
msgid "Place Voxels on a 3D canvas with others"
msgstr "Coloque cubos em um canvas 3D com outras pessoas."
#: src/canvasesDesc.js:31
msgid "Special canvas to spread awareness of SARS-CoV2"
msgstr "Canvas especial para conscientizar sobre o SARS-CoV2"
#: src/canvasesDesc.js:32
msgid "Mirror of PixelZone"
msgstr "Espelho do PixelZone"
#: src/canvasesDesc.js:33
msgid "Mirror of PixelCanvas"
msgstr "Espelho do PixelCanvas"
#: src/canvasesDesc.js:34
msgid "Black and White canvas"
msgstr "Canvas preto e branco"

View File

@ -89,12 +89,15 @@ const ChannelDropDown = ({
}
// latest lastTs first
sortChansNew.sort((c1, c2) => {
// determins if default channels get sorted too
// if (c1[3] === 0 || c2[3] === 0) return 0;
if (c1[4] > c2[4]) return -1;
if (c2[4] > c1[4]) return 1;
return 0;
});
// unread first
sortChansNew.sort((c1, c2) => {
// if (c1[3] === 0 || c2[3] === 0) return 0;
if (c1[1] && !c2[1]) return -1;
if (c2[1] && !c1[1]) return 1;
return 0;

View File

@ -15,6 +15,7 @@ export class ChatProvider {
constructor() {
this.defaultChannels = {};
this.langChannels = {};
this.langChannelIds = [];
this.enChannelId = 0;
this.intChannelId = 0;
this.infoUserId = 1;
@ -74,8 +75,8 @@ export class ChatProvider {
];
}
// find or create non-english lang channels
const langs = Object.key(ttags);
for (let i = 0; i < langs; i += 1) {
const langs = Object.keys(ttags);
for (let i = 0; i < langs.length; i += 1) {
const name = langs[i];
if (name === 'default') {
continue;
@ -90,10 +91,10 @@ export class ChatProvider {
const { id, type, lastTs } = channel[0];
this.langChannels[name] = {
id,
name,
type,
lastTs,
};
this.langChannelIds[id] = name;
}
// find or create default users
let name = INFO_USER_NAME;
@ -128,14 +129,17 @@ export class ChatProvider {
getDefaultChannels(lang) {
const { defaultChannels, langChannels } = this;
const channels = { ...defaultChannels };
const langChannel = {};
if (lang && lang !== 'default' && langChannels[lang]) {
const {
id, name, type, lastTs,
id, type, lastTs,
} = langChannels[lang];
channels[id] = [name, type, lastTs];
langChannel[id] = [lang, type, lastTs];
}
return channels;
return {
...langChannel,
...defaultChannels,
};
}
static async addUserToChannel(
@ -160,12 +164,19 @@ export class ChatProvider {
}
}
userHasChannelAccess(user, cid, write = false) {
/*
* user.lang has to be set
* this is just the case in chathistory.js and SocketServer
*/
userHasChannelAccess(user, cid) {
if (this.defaultChannels[cid]) {
if (!write || user.regUser) {
return true;
}
} else if (user.regUser && user.channels[cid]) {
return true;
}
if (this.langChannelIds[cid]
&& this.langChannelIds[cid] === user.lang) {
return true;
}
if (user.channels[cid]) {
return true;
}
return false;
@ -256,20 +267,20 @@ export class ChatProvider {
}
/*
* User.ttag for translation has to be set, this is just the case
* in SocketServer for websocket connections
* @param user User object
* @param message string of message
* @param channelId integer of channel
* @param ttag for translating return string
* @return error message if unsuccessful, otherwise null
*/
async sendMessage(
user,
message,
channelId,
ttag,
) {
const { id } = user;
const { t } = ttag;
const { t } = user.ttag;
const name = user.getName();
if (!user.userlvl && await cheapDetector(user.ip)) {

View File

@ -13,14 +13,16 @@ const ttags = {
};
(() => {
localeImports.keys().forEach((file) => {
const langs = localeImports.keys();
for (let i = 0; i < langs.length; i += 1) {
const file = langs[i];
const ttag = new TTag();
// ./ssr-de.po
const lang = file.replace('./ssr-', '').replace('.po', '');
ttag.addLocale(lang, localeImports(file).default);
ttag.useLocale(lang);
ttags[lang] = ttag;
});
}
})();
export function getTTag(lang) {
@ -29,7 +31,7 @@ export function getTTag(lang) {
export function expressTTag(req, res, next) {
const language = req.headers['accept-language'];
req.lang = (language) ? languageFromLocalisation(language) : 'en';
req.lang = (language) ? languageFromLocalisation(language) : 'default';
req.ttag = getTTag(req.lang);
next();
}

View File

@ -36,8 +36,9 @@ async function chatHistory(req: Request, res: Response) {
}
const { user } = req;
user.lang = req.lang;
if (!chatProvider.userHasChannelAccess(user, cid, false)) {
if (!chatProvider.userHasChannelAccess(user, cid)) {
res.status(401);
res.json({
errors: ['You don\'t have access to this channel'],

View File

@ -81,8 +81,6 @@ router.use((req, res, next) => {
router.post('/mctp', mctp);
router.get('/chathistory', chatHistory);
router.post('/startdm', startDm);
router.post('/leavechan', leaveChan);
@ -91,8 +89,13 @@ router.post('/block', block);
router.post('/blockdm', blockdm);
/*
* make localisations available
*/
router.use(expressTTag);
router.get('/chathistory', chatHistory);
router.get('/me', me);
router.use('/auth', auth(passport));

View File

@ -340,7 +340,6 @@ class SocketServer extends WebSocketEvents {
user,
message,
channelId,
user.ttag,
);
if (errorMsg) {
ws.send(JSON.stringify([

View File

@ -30,6 +30,7 @@ function authenticateClient(req) {
: new User(null, getIPFromRequest(req));
user.setCountry(countryCode);
user.ttag = req.ttag;
user.lang = req.lang;
resolve(user);
});
}),