diff --git a/aegisub/configure.in b/aegisub/configure.in index 604ba499d..76b9258f5 100644 --- a/aegisub/configure.in +++ b/aegisub/configure.in @@ -630,6 +630,34 @@ AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The basename for our gettext translation domains.]) +################ +# Update checker +################ +AC_MSG_CHECKING([whether to enable the update checker]) +AC_ARG_ENABLE(update-checker, + AS_HELP_STRING([--disable-update-checker], [disable the update checker [no]])) +AC_MSG_RESULT(${enable_update_checker:=yes}) +AS_IF([test "x$enable_update_checker" != "xno"], + [AC_DEFINE([WITH_UPDATE_CHECKER], [], + [Whether to enable the update checker])]) + +AC_MSG_CHECKING([for update checker server]) +AC_ARG_WITH(update-server, + AS_HELP_STRING([--with-update-server=HOSTNAME], + [Server to use for the update checker + [updates.aegisub.org]])) +AC_MSG_RESULT(${with_update_server:=updates.aegisub.org}) +AC_DEFINE_UNQUOTED([UPDATE_CHECKER_SERVER], ["$with_update_server"], + [Server for the update checker]) + +AC_MSG_CHECKING([for update checker base URL]) +AC_ARG_WITH(update-url, + AS_HELP_STRING([--with-update-url=HOSTNAME], + [Base path to use for the update checker [/trunk]])) +AC_MSG_RESULT(${with_update_url:=/trunk}) +AC_DEFINE_UNQUOTED([UPDATE_CHECKER_BASE_URL], ["$with_update_url"], + [Base path for the update checker]) + #################################################################### # Default settings for Providers/Players # * This is done at the end to preserve sanity rather than littering diff --git a/aegisub/src/command/app.cpp b/aegisub/src/command/app.cpp index bbcd98f55..0efad2119 100644 --- a/aegisub/src/command/app.cpp +++ b/aegisub/src/command/app.cpp @@ -314,6 +314,8 @@ namespace cmd { reg(new app_options); reg(new app_toggle_global_hotkeys); reg(new app_toggle_toolbar); +#ifdef WITH_UPDATE_CHECKER reg(new app_updates); +#endif } } diff --git a/aegisub/src/config/config_windows0.h b/aegisub/src/config/config_windows0.h index cd6303265..e730cf88e 100644 --- a/aegisub/src/config/config_windows0.h +++ b/aegisub/src/config/config_windows0.h @@ -128,7 +128,9 @@ # define UPDATE_CHECKER_ACCEPT_TAGS "win64 source" #endif - +// Where the update checker should look for updates +#define UPDATE_CHECKER_SERVER "updates.aegisub.org" +#define UPDATE_CHECKER_BASE_URL "/trunk" ///////////// NOT RECOMMENDED ///////////// diff --git a/aegisub/src/dialog_version_check.cpp b/aegisub/src/dialog_version_check.cpp index 6a9209af6..256c48174 100644 --- a/aegisub/src/dialog_version_check.cpp +++ b/aegisub/src/dialog_version_check.cpp @@ -37,6 +37,8 @@ #include "config.h" +#ifdef WITH_UPDATE_CHECKER + #include "dialog_version_check.h" #ifndef AGI_PRE @@ -325,24 +327,20 @@ void AegisubVersionCheckerThread::DoCheck() inserter(accept_tags, accept_tags.end())); #endif - const wxString servername = "updates.aegisub.org"; - const wxString base_updates_path = "/trunk"; - - wxString querystring = wxString::Format( - "?rev=%d&rel=%d&os=%s&lang=%s", + wxString path = wxString::Format( + "%s?rev=%d&rel=%d&os=%s&lang=%s", + UPDATE_CHECKER_BASE_URL, GetSVNRevision(), GetIsOfficialRelease()?1:0, GetOSShortName(), GetSystemLanguage()); - wxString path = base_updates_path + querystring; - wxHTTP http; http.SetHeader("User-Agent", wxString("Aegisub ") + GetAegisubLongVersionString()); http.SetHeader("Connection", "Close"); http.SetFlags(wxSOCKET_WAITALL | wxSOCKET_BLOCK); - if (!http.Connect(servername)) + if (!http.Connect(UPDATE_CHECKER_SERVER)) throw VersionCheckError(STD_STR(_("Could not connect to updates server."))); agi::scoped_ptr stream(http.GetInputStream(path)); @@ -533,3 +531,5 @@ static void register_event_handler() wxTheApp->Bind(AEGISUB_EVENT_VERSIONCHECK_RESULT, on_update_result); is_registered = true; } + +#endif diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index 58bb1a3c5..a4ae8685a 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -211,12 +211,16 @@ FrameMain::FrameMain (wxArrayString args) StartupLog("Possibly perform automatic updates check"); if (OPT_GET("App/First Start")->GetBool()) { OPT_SET("App/First Start")->SetBool(false); +#ifdef WITH_UPDATE_CHECKER int result = wxMessageBox(_("Do you want Aegisub to check for updates whenever it starts? You can still do it manually via the Help menu."),_("Check for updates?"), wxYES_NO | wxCENTER); OPT_SET("App/Auto/Check For Updates")->SetBool(result == wxYES); config::opt->Flush(); +#endif } +#ifdef WITH_UPDATE_CHECKER PerformVersionCheck(false); +#endif StartupLog("Leaving FrameMain constructor"); }