@capgo/capacitor-updater 8.43.9 → 8.43.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -84,7 +84,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
84
84
|
private static final String[] BREAKING_EVENT_NAMES = { "breakingAvailable", "majorAvailable" };
|
|
85
85
|
private static final String LAST_FAILED_BUNDLE_PREF_KEY = "CapacitorUpdater.lastFailedBundle";
|
|
86
86
|
|
|
87
|
-
private final String pluginVersion = "8.43.
|
|
87
|
+
private final String pluginVersion = "8.43.10";
|
|
88
88
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
89
89
|
|
|
90
90
|
private SharedPreferences.Editor editor;
|
|
@@ -91,27 +91,36 @@ public class DownloadService extends Worker {
|
|
|
91
91
|
.protocols(Arrays.asList(Protocol.HTTP_2, Protocol.HTTP_1_1))
|
|
92
92
|
.addInterceptor((chain) -> {
|
|
93
93
|
Request originalRequest = chain.request();
|
|
94
|
-
String userAgent =
|
|
95
|
-
"CapacitorUpdater/" +
|
|
96
|
-
(currentPluginVersion != null ? currentPluginVersion : "unknown") +
|
|
97
|
-
" (" +
|
|
98
|
-
(currentAppId != null ? currentAppId : "unknown") +
|
|
99
|
-
") android/" +
|
|
100
|
-
(currentVersionOs != null ? currentVersionOs : "unknown");
|
|
94
|
+
String userAgent = buildUserAgent(currentAppId, currentPluginVersion, currentVersionOs);
|
|
101
95
|
Request requestWithUserAgent = originalRequest.newBuilder().header("User-Agent", userAgent).build();
|
|
102
96
|
return chain.proceed(requestWithUserAgent);
|
|
103
97
|
})
|
|
104
98
|
.build();
|
|
105
99
|
}
|
|
106
100
|
|
|
101
|
+
static String buildUserAgent(String appId, String pluginVersion, String versionOs) {
|
|
102
|
+
return (
|
|
103
|
+
"CapacitorUpdater/" +
|
|
104
|
+
sanitizeUserAgentValue(pluginVersion) +
|
|
105
|
+
" (" +
|
|
106
|
+
sanitizeUserAgentValue(appId) +
|
|
107
|
+
") android/" +
|
|
108
|
+
sanitizeUserAgentValue(versionOs)
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private static String sanitizeUserAgentValue(String value) {
|
|
113
|
+
return value == null || value.isEmpty() ? "unknown" : value;
|
|
114
|
+
}
|
|
115
|
+
|
|
107
116
|
// Method to update User-Agent values
|
|
108
117
|
public static void updateUserAgent(String appId, String pluginVersion, String versionOs) {
|
|
109
|
-
currentAppId = appId
|
|
110
|
-
currentPluginVersion = pluginVersion
|
|
111
|
-
currentVersionOs = versionOs
|
|
112
|
-
logger
|
|
113
|
-
"Updated User-Agent:
|
|
114
|
-
|
|
118
|
+
currentAppId = sanitizeUserAgentValue(appId);
|
|
119
|
+
currentPluginVersion = sanitizeUserAgentValue(pluginVersion);
|
|
120
|
+
currentVersionOs = sanitizeUserAgentValue(versionOs);
|
|
121
|
+
if (logger != null) {
|
|
122
|
+
logger.debug("Updated User-Agent: " + buildUserAgent(currentAppId, currentPluginVersion, currentVersionOs));
|
|
123
|
+
}
|
|
115
124
|
}
|
|
116
125
|
|
|
117
126
|
public DownloadService(@NonNull Context context, @NonNull WorkerParameters params) {
|
|
@@ -72,7 +72,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
72
72
|
CAPPluginMethod(name: "completeFlexibleUpdate", returnType: CAPPluginReturnPromise)
|
|
73
73
|
]
|
|
74
74
|
public var implementation = CapgoUpdater()
|
|
75
|
-
private let pluginVersion: String = "8.43.
|
|
75
|
+
private let pluginVersion: String = "8.43.10"
|
|
76
76
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
77
77
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
78
78
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|