38 lines
3.9 KiB
Python
38 lines
3.9 KiB
Python
from pathlib import Path
|
|
import re
|
|
root = Path(__file__).resolve().parents[1]
|
|
for directory in ('lib/core/links', 'lib/frontend', 'test', 'lib/l10n'):
|
|
for path in (root / directory).rglob('*'):
|
|
if path.suffix not in ('.dart', '.arb'):
|
|
continue
|
|
source = path.read_text(encoding='utf-8')
|
|
text = source.replace('https://web.max.ru', 'https://ikar.kusoft.xyz').replace('www.max.ru', 'ikar.kusoft.xyz').replace('max.ru', 'ikar.kusoft.xyz')
|
|
text = text.replace("'qlyra'", "'ikar'").replace('"qlyra"', '"ikar"')
|
|
text = text.replace('qlyra://', 'ikar://').replace(r'max\.ru', r'ikar\.kusoft\.xyz')
|
|
text = re.sub(r'\bMAX\b', 'ИКАР', text)
|
|
if text != source:
|
|
path.write_text(text, encoding='utf-8')
|
|
for locale, text in {
|
|
'ru': '''ИКАР — независимый мессенджер.
|
|
Сообщения и файлы передаются через собственный сервер ИКАР. Сервер хранит аккаунты, историю и вложения на внешнем диске. Сквозное шифрование включается в настройках чата; незашифрованные сообщения доступны серверу. Не публикуйте чужие персональные данные без согласия. Блокировки, приватность и удаление сообщений доступны в приложении.
|
|
Номер используется как идентификатор аккаунта. Вход подтверждается ключом устройства; приложение не отправляет SMS и не удостоверяет владение номером. Не выдавайте себя за другого человека.
|
|
Цифровая карточка ИКАР служит для общения внутри ИКАР и не является государственным удостоверением личности.''',
|
|
'en': '''IKAR is an independent messenger.
|
|
Messages and files use IKAR's own server. Accounts, history and attachments are stored on an external disk. End-to-end encryption can be enabled in chat settings; unencrypted messages are accessible to the server. Do not publish another person's personal data without consent. Blocking, privacy settings and message deletion are available in the app.
|
|
A phone number is an account identifier. A device key confirms sign-in; the app does not send SMS or certify ownership of a number. Do not impersonate another person.
|
|
An IKAR profile card is for communication inside IKAR, not a government identity document.'''
|
|
}.items():
|
|
(root / f'lib/l10n/tos_{locale}.dart').write_text(f"const String kTermsOfService{locale.title()} = r'''\n{text}\n''';\n", encoding='utf-8')
|
|
path = root / 'lib/backend/modules/digital_id.dart'
|
|
text = path.read_text(encoding='utf-8').replace('https://ext-api.max.ru', 'https://ikar.kusoft.xyz/api/ikar/digital-id').replace('https://digital-id.max.ru/', 'https://ikar.kusoft.xyz/').replace('https://digital-id.max.ru', 'https://ikar.kusoft.xyz')
|
|
path.write_text(text, encoding='utf-8')
|
|
path = root / 'android/app/src/main/AndroidManifest.xml'
|
|
text = path.read_text(encoding='utf-8').replace('android:scheme="qlyra"', 'android:scheme="ikar"').replace('android:host="max.ru"', 'android:host="ikar.kusoft.xyz"')
|
|
path.write_text(text, encoding='utf-8')
|
|
path = root / 'analysis_options.yaml'
|
|
text = path.read_text(encoding='utf-8').replace(' exclude:\n', ' exclude:\n - .migration/**\n - ikar_server/**\n')
|
|
path.write_text(text, encoding='utf-8')
|
|
path = root / '.gitignore'
|
|
path.write_text(path.read_text(encoding='utf-8') + '\n# IKAR local secrets and generated artifacts\n.secrets/\n.migration/\n*.log\nikar-*.tgz\nikar_server/**/bin/\nikar_server/**/obj/\nikar_server/publish/\nikar_server/.env*\n!ikar_server/.env.example\nartifacts/\n', encoding='utf-8')
|
|
print('ИКАР identity, links and terms updated')
|