Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo #86

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var WidivineExtensionID = "oimompecagnajdejgnnjijobebaeigek"

// AllExtensionsMap holds a mapping of extension ID to extension object.
// This list for tests is populated by extensions.OfferedExtensions.
// For normal operaitons of this server it is obtained from the AWS config
// For normal operations of this server it is obtained from the AWS config
// of the host machine for DynamoDB.
var AllExtensionsMap = extension.NewExtensionMap()

Expand Down Expand Up @@ -126,7 +126,7 @@ func PrintExtensions(w http.ResponseWriter, r *http.Request) {
}
}

// WebStoreUpdateExtension is the handler for updating extensions made via the GET HTTP methhod.
// WebStoreUpdateExtension is the handler for updating extensions made via the GET HTTP method.
// Get requests look like this:
// /extensions?os=mac&arch=x64&os_arch=x86_64&nacl_arch=x86-64&prod=chromiumcrx&prodchannel=&prodversion=69.0.54.0&lang=en-US&acceptformat=crx2,crx3&x=id%3Doemmndcbldboiebfnladdacbdfmadadm%26v%3D0.0.0.0%26installedby%3Dpolicy%26uc%26ping%3Dr%253D-1%2526e%253D1"
// The query parameter x contains the encoded extension information, there can be more than one x parameter.
Expand Down
2 changes: 1 addition & 1 deletion extension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type UpdateRequest Extensions
type UpdateResponse Extensions

// WebStoreUpdateResponse represents a webstore XML response.
// There is no symmetric WebStoreUpdateRequest becuase the request is URL query parameters.
// There is no symmetric WebStoreUpdateRequest because the request is URL query parameters.
type WebStoreUpdateResponse Extensions

// CompareVersions compares 2 versions:
Expand Down
16 changes: 8 additions & 8 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@ func TestUpdateExtensionsXML(t *testing.T) {
</response>`
testCall(t, server, http.MethodPost, contentTypeXML, "", requestBody, http.StatusOK, expectedResponse, "")

// Unkonwn extension ID goes to Google server via componentupdater proxy
// Unknown extension ID goes to Google server via componentupdater proxy
requestBody = extensiontest.ExtensionRequestFnForXML("aaaaaaaaaaaaaaaaaaaa")("0.0.0")
expectedResponse = ""
testCall(t, server, http.MethodPost, contentTypeXML, "", requestBody, http.StatusTemporaryRedirect, expectedResponse, "https://componentupdater.brave.com/service/update2")

// Unkonwn extension ID goes to Google server via componentupdater proxy
// Unknown extension ID goes to Google server via componentupdater proxy
// and preserves query params
requestBody = extensiontest.ExtensionRequestFnForXML("aaaaaaaaaaaaaaaaaaaa")("0.0.0")
expectedResponse = ""
Expand Down Expand Up @@ -378,7 +378,7 @@ func TestWebStoreUpdateExtensionXML(t *testing.T) {
expectedResponse = `<gupdate protocol="3.1" server="prod"></gupdate>`
testCall(t, server, http.MethodGet, contentTypeXML, query, requestBody, http.StatusOK, expectedResponse, "")

// Unkonwn extension ID goes to Google server
// Unknown extension ID goes to Google server
unknownExtension := extension.Extension{
ID: "aaaaaaaaaaaaaaaaaaaa",
Version: "0.0.0",
Expand All @@ -387,7 +387,7 @@ func TestWebStoreUpdateExtensionXML(t *testing.T) {
expectedResponse = `<a href="https://extensionupdater.brave.com/service/update2/crx?x=id%3Daaaaaaaaaaaaaaaaaaaa%26v%3D0.0.0">Temporary Redirect</a>.`
testCall(t, server, http.MethodGet, contentTypeXML, query, requestBody, http.StatusTemporaryRedirect, expectedResponse, "https://extensionupdater.brave.com/service/update2/crx?x=id%3Daaaaaaaaaaaaaaaaaaaa%26v%3D0.0.0")

// Unkonwn extension ID with multiple extensions, we try to handle ourselves.
// Unknown extension ID with multiple extensions, we try to handle ourselves.
unknownExtension = extension.Extension{
ID: "aaaaaaaaaaaaaaaaaaaa",
Version: "0.0.0",
Expand Down Expand Up @@ -465,12 +465,12 @@ func TestUpdateExtensionsJSON(t *testing.T) {
expectedResponse = jsonPrefix + `{"response":{"protocol":"3.1","server":"prod","app":[{"appid":"ldimlcelhnjgpjjemdjokpgeeikdinbm","status":"ok","updatecheck":{"status":"ok","urls":{"url":[{"codebase":"https://` + extension.GetS3ExtensionBucketHost(lightThemeExtensionID) + `/release/ldimlcelhnjgpjjemdjokpgeeikdinbm/extension_1_0_0.crx"}]},"manifest":{"version":"1.0.0","packages":{"package":[{"name":"extension_1_0_0.crx","hash_sha256":"1c714fadd4208c63f74b707e4c12b81b3ad0153c37de1348fa810dd47cfc5618","required":true}]}}}},{"appid":"bfdgpgibhagkpdlnjonhkabjoijopoge","status":"ok","updatecheck":{"status":"ok","urls":{"url":[{"codebase":"https://` + extension.GetS3ExtensionBucketHost(darkThemeExtensionID) + `/release/bfdgpgibhagkpdlnjonhkabjoijopoge/extension_1_0_0.crx"}]},"manifest":{"version":"1.0.0","packages":{"package":[{"name":"extension_1_0_0.crx","hash_sha256":"ae517d6273a4fc126961cb026e02946db4f9dbb58e3d9bc29f5e1270e3ce9834","required":true}]}}}}]}}`
testCall(t, server, http.MethodPost, contentTypeJSON, "", requestBody, http.StatusOK, expectedResponse, "")

// Unkonwn extension ID goes to Google server via componentupdater proxy
// Unknown extension ID goes to Google server via componentupdater proxy
requestBody = extensiontest.ExtensionRequestFnForJSON("aaaaaaaaaaaaaaaaaaaa")("0.0.0")
expectedResponse = ""
testCall(t, server, http.MethodPost, contentTypeJSON, "", requestBody, http.StatusTemporaryRedirect, expectedResponse, "https://componentupdater.brave.com/service/update2/json")

// Unkonwn extension ID goes to Google server via componentupdater proxy
// Unknown extension ID goes to Google server via componentupdater proxy
// and preserves query params
requestBody = extensiontest.ExtensionRequestFnForJSON("aaaaaaaaaaaaaaaaaaaa")("0.0.0")
expectedResponse = ""
Expand Down Expand Up @@ -531,7 +531,7 @@ func TestWebStoreUpdateExtensionJSON(t *testing.T) {
expectedResponse = `{"gupdate":{"protocol":"3.1","server":"prod","app":null}}`
testCall(t, server, http.MethodGet, contentTypeJSON, query, requestBody, http.StatusOK, expectedResponse, "")

// Unkonwn extension ID goes to Google server
// Unknown extension ID goes to Google server
unknownExtension := extension.Extension{
ID: "aaaaaaaaaaaaaaaaaaaa",
Version: "0.0.0",
Expand All @@ -540,7 +540,7 @@ func TestWebStoreUpdateExtensionJSON(t *testing.T) {
expectedResponse = "<a href=\"https://extensionupdater.brave.com/service/update2/crx?x=id%3Daaaaaaaaaaaaaaaaaaaa%26v%3D0.0.0\">Temporary Redirect</a>."
testCall(t, server, http.MethodGet, contentTypeJSON, query, requestBody, http.StatusTemporaryRedirect, expectedResponse, "https://extensionupdater.brave.com/service/update2/crx?x=id%3Daaaaaaaaaaaaaaaaaaaa%26v%3D0.0.0")

// Unkonwn extension ID with multiple extensions, we try to handle ourselves.
// Unknown extension ID with multiple extensions, we try to handle ourselves.
unknownExtension = extension.Extension{
ID: "aaaaaaaaaaaaaaaaaaaa",
Version: "0.0.0",
Expand Down