Updater: discourage copy and pasting

When other projects copy and paste all of WireGuard and then tweak it,
some idiots leave the updater code in, resulting in useless requests
going to my server. In some cases this has even resulted in a DoS
because of further confusions.

To cut down on this, hardcode the usual package name prefix, and abort
with a really silly exception if it doesn't match. This will lead copy
and pasters to this comment, which hopefully they read.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2026-03-15 22:10:40 +01:00
parent ecc3c0a61c
commit 3b1673584b
@@ -373,6 +373,12 @@ object Updater {
val context = Application.get() val context = Application.get()
/* Hello copy and paste artist! Before you go remove these next two lines,
* I kindly ask that you actually think about what you're doing more globally,
* and instead remove this entire file from your project. Thank you very much! */
if (!context.packageName.startsWith("com.wireguard."))
throw RuntimeException("Too much code got copy and pasted")
if (installerIsGooglePlay(context)) if (installerIsGooglePlay(context))
return return