-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
Sending a more explicit header when doing a scan/query from Smoothie #2248
Comments
Please also add the platform ios / android |
Can we use User-Agent? @teolemon |
You're already supposed to see something like that, isn't that the case? UserAgent(
name: 'Smoothie - ${packageInfo.appName}',
version: '${packageInfo.version}+${packageInfo.buildNumber}',
system: Platform.operatingSystemVersion,
url: 'https://world.openfoodfacts.org/',
); Regarding using the user agent for a distinction between scan and search, it would mean changing the user agent for each query (ok, we have the technology for that) while it's supposed to be kind of static. |
Correction: the "user agent" parameters are supposed to appear as get/post parameters (cf. map['app_name'] = OpenFoodAPIConfiguration.userAgent!.name!;
map['app_version'] = OpenFoodAPIConfiguration.userAgent!.version!;
map['app_uuid'] = OpenFoodAPIConfiguration.uuid!; |
@teolemon Actually looking back at the OP we don't call |
@monsieurtanuki is that ok for @cli1005 to work on this ? As we get Dart info in the logs, I believe it's a client side issue (eg Smoothie) |
The issue might be in Open Food Facts API... and the API accepts only app_name, app_version, app_uuid actually, if you want send more informations, like device system(ios/android) or comment (instead of what I did in #2262), we might have to modify the Open Food Facts API as well. Another question, @teolemon could you please tell me how to find the log as you mentioned in the issue description? thanks |
@cli1005 Indeed. We should probably add something like |
app_platform and comment have been added into UserAgentParameters (openfoodfacts/openfoodfacts-dart#482).
I could add Scan/ Search in parameter comment will sending in Smoothie, but it might be better to do it in OFF API... |
Hi @monsieurtanuki, having the app name + platform + source of query (scan, or search, or list) in the UserAgent is very useful server side as we get the UserAgent in the nginx + Apache logs directly, before we interpret GET or POST parameters. This is used currently to get scan statistics from our app for products: we just parse nginx logs. |
It's an internal redirect server side, any call to /api/ will be handled by display.pl |
There is redirection server side done by a nginx reverse proxy. This proxy does not analyze the POST parameters, it just passes them along. But it is very useful for us to be able to identify our app, and scans, in this nginx reverse proxy. |
@stephanegigandet Ok then. We go a little beyond the normal use of User Agent, fair enough. A little problem is that the User Agent is static: that made sense to use a static field for characteristics that don't change often (e.g. device or app version), that's a bit lousy for something that is supposed to be changed at every request (e.g. 2 requests in parallel and the second request overwrites the first one's user agent). I guess we can live with that, it's not like one user scans two products at the very same time. With @cli1005's #484. now we have a "comment" field in user agent, so we are ok I guess: const UserAgent({
this.name,
this.version,
this.system,
this.url,
this.comment,
}); |
…rcode search Impacted files: * `barcode_product_query.dart`: new parameter `isScanned` to distinguish scan and barcode search via the user agent comment field * `continuous_scan_model.dart`: "this IS a scan" * `product_dialog_helper.dart`: "this is NOT a scan" * `product_query.dart`: new method to set the user agent comment field
…2408) Impacted files: * `barcode_product_query.dart`: new parameter `isScanned` to distinguish scan and barcode search via the user agent comment field * `continuous_scan_model.dart`: "this IS a scan" * `product_dialog_helper.dart`: "this is NOT a scan" * `product_query.dart`: new method to set the user agent comment field
What
At the moment the log looks like this:
The text was updated successfully, but these errors were encountered: