diff --git a/branding.conf b/branding.conf new file mode 100644 index 000000000..e1438bf00 --- /dev/null +++ b/branding.conf @@ -0,0 +1,26 @@ +# Branding +# +# You are kindly asked to replace all links if you are +# distributing a build with custom branding. +# +# Support will not be provided to your users without +# prior agreement. +# +# You may not make your builds publicly available +# without modifying the app ID and all relevant files, +# as it won't be able to co-exist with Tuba. +# +# This is mostly aimed at organizations for internal +# usage, limited to their instances. +NAME=Tuba +WEBSITE=https://github.com/GeopJr/Tuba +ISSUES_WEBSITE=https://github.com/GeopJr/Tuba/issues +SUPPORT_WEBSITE=https://matrix.to/%23/%23tuba:gnome.org +DONATE_WEBSITE=https://geopjr.dev/donate +TRANSLATE_WEBSITE=https://hosted.weblate.org/engage/tuba/ +WIKI_WEBSITE=https://github.com/GeopJr/Tuba/wiki +# Prefilled instance when logging in. +# This does not limit your users from +# logging in to other instances. +# e.g. faraway.town +DEFAULT_INSTANCE= diff --git a/meson.build b/meson.build index a1eb75b46..f90823bd7 100644 --- a/meson.build +++ b/meson.build @@ -19,23 +19,27 @@ endif devel = get_option('devel') distro = get_option('distro') +branding = import('keyval').load('branding.conf') +assert(branding.get('NAME') != '', 'Branding: Name cannot be empty.') + # Setup configuration file config = configuration_data() config.set('EXEC_NAME', meson.project_name()) config.set('GETTEXT_PACKAGE', meson.project_name()) config.set('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) config.set('DOMAIN', meson.project_name ()) -config.set('G_LOG_DOMAIN', 'Tuba') +config.set('G_LOG_DOMAIN', branding.get('NAME', 'Tuba')) config.set('RESOURCES', '/' + '/'.join(meson.project_name().split('.')) + '/') config.set('VERSION', meson.project_version()) config.set('PREFIX', get_option('prefix')) -config.set('NAME', 'Tuba') -config.set('WEBSITE', 'https://github.com/GeopJr/Tuba') -config.set('ISSUES_WEBSITE', 'https://github.com/GeopJr/Tuba/issues') -config.set('SUPPORT_WEBSITE', 'https://matrix.to/#/#tuba:gnome.org') -config.set('DONATE_WEBSITE', 'https://geopjr.dev/donate') -config.set('TRANSLATE_WEBSITE', 'https://hosted.weblate.org/engage/tuba/') -config.set('WIKI_WEBSITE', 'https://github.com/GeopJr/Tuba/wiki') +config.set('NAME', branding.get('NAME', 'Tuba')) +config.set('WEBSITE', branding.get('WEBSITE', 'https://github.com/GeopJr/Tuba')) +config.set('ISSUES_WEBSITE', branding.get('ISSUES_WEBSITE', 'https://github.com/GeopJr/Tuba/issues')) +config.set('SUPPORT_WEBSITE', branding.get('SUPPORT_WEBSITE', 'https://matrix.to/#/#tuba:gnome.org')) +config.set('DONATE_WEBSITE', branding.get('DONATE_WEBSITE', 'https://geopjr.dev/donate')) +config.set('TRANSLATE_WEBSITE', branding.get('TRANSLATE_WEBSITE', 'https://hosted.weblate.org/engage/tuba/')) +config.set('WIKI_WEBSITE', branding.get('WIKI_WEBSITE', 'https://github.com/GeopJr/Tuba/wiki')) +config.set('DEFAULT_INSTANCE', branding.get('DEFAULT_INSTANCE', '')) config.set('PROFILE', devel ? 'development' : 'production') if devel @@ -63,7 +67,7 @@ endif add_project_arguments(['--vapidir=' + meson.project_source_root() / 'vapi'], language: 'vala') add_project_arguments ( '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), - '-DG_LOG_DOMAIN="Tuba"', + '-DG_LOG_DOMAIN="@0@"'.format(config.get('G_LOG_DOMAIN')), language: 'c' ) diff --git a/src/Application.vala b/src/Application.vala index 8804e5398..0763a6fbf 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -481,10 +481,12 @@ namespace Tuba { }; // translators: Wiki pages / Guides - dialog.add_link (_("Wiki"), Build.WIKI_WEBSITE); - - dialog.add_link (_("Translate"), Build.TRANSLATE_WEBSITE); - dialog.add_link (_("Donate"), Build.DONATE_WEBSITE); + if (Build.WIKI_WEBSITE != "") + dialog.add_link (_("Wiki"), Build.WIKI_WEBSITE); + if (Build.TRANSLATE_WEBSITE != "") + dialog.add_link (_("Translate"), Build.TRANSLATE_WEBSITE); + if (Build.DONATE_WEBSITE != "") + dialog.add_link (_("Donate"), Build.DONATE_WEBSITE); // For some obscure reason, const arrays produce duplicates in the credits. // Static functions seem to avoid this peculiar behavior. diff --git a/src/Build.vala.in b/src/Build.vala.in index ebe7548f0..64f1e5dfa 100644 --- a/src/Build.vala.in +++ b/src/Build.vala.in @@ -4,6 +4,7 @@ namespace Build { public const string DOMAIN = "@DOMAIN@"; public const string RESOURCES = "@RESOURCES@"; public const string PROFILE = "@PROFILE@"; + public const string DEFAULT_INSTANCE = "@DEFAULT_INSTANCE@"; public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@"; public const string LOCALEDIR = "@LOCALEDIR@"; diff --git a/src/Dialogs/NewAccount.vala b/src/Dialogs/NewAccount.vala index d0dc77cd5..9678c2b1c 100644 --- a/src/Dialogs/NewAccount.vala +++ b/src/Dialogs/NewAccount.vala @@ -47,6 +47,9 @@ public class Tuba.Dialogs.NewAccount: Adw.Window { reset (); present (); instance_entry.grab_focus (); + + if (Build.DEFAULT_INSTANCE != "") + instance_entry.text = Build.DEFAULT_INSTANCE; } public bool on_manual_auth (string url) { @@ -130,8 +133,11 @@ public class Tuba.Dialogs.NewAccount: Adw.Window { .with_account (account) .with_form_data ("client_name", Build.NAME) .with_form_data ("redirect_uris", redirect_uri = setup_redirect_uri ()) - .with_form_data ("scopes", SCOPES) - .with_form_data ("website", Build.WEBSITE); + .with_form_data ("scopes", SCOPES); + + if (Build.WEBSITE != "") + msg.with_form_data ("website", Build.WEBSITE); + yield msg.await (); var parser = Network.get_parser_from_inputstream (msg.response_body);