Fossil

Check-in [4de677dc]
Login

Check-in [4de677dc]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change the algorithm for detecting when a user agent is a narrow-screen mobile device to the algorithm recommanded at https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#mobile_device_detection.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4de677dcc3e61228a1128759892d12998bdb300e4b169b80cd2fbd0fe3a281a3
User & Date: drh 2021-03-01 20:54:45
Context
2021-03-02
13:55
Alternative skins can be determined by the "skin" field of the display preferences cookie. The "skn_X" mechanism is removed. ... (check-in: 33394207 user: drh tags: trunk)
07:11
Skin selection is now stored in the user display prefs cookie and can be modified from any page by passing the skin=xyz URL parameter. Gets trumped by /draftX URI or --skin CLI flag or skin: CGI config setting. Removed /skn_XYZ URI handling. /skins page now uses the new mechanism for skin selection. UDC is now rendered on every page if it was modified during that request, regardless of the 'udc' URL parameter. See discussion at /forumpost/4d3a10c72a. ... (check-in: 71a2d68a user: stephan tags: skin-preference-cookie)
2021-03-01
20:54
Change the algorithm for detecting when a user agent is a narrow-screen mobile device to the algorithm recommanded at https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#mobile_device_detection. ... (check-in: 4de677dc user: drh tags: trunk)
20:37
If the diff type (unified vs. side-by-side) is not specified by a query parameter or cookie, then determine the diff type based on the "preferred-diff-type" setting, if there is one, or on a guess whether or not the requesting agent is a mobile device based on the User-Agent parameter in the HTTP request. ... (check-in: 29bab274 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/login.c.

431
432
433
434
435
436
437




438
439
440
441
442
443
444
445
446
447
448
449
450
451
452

/*
** Make a guess at whether or not the requestor is a mobile device or
** a desktop device (narrow screen vs. wide screen) based the HTTP_USER_AGENT
** parameter.  Return true for mobile and false for desktop.
**
** Caution:  This is only a guess.




*/
int user_agent_is_likely_mobile(void){
  const char *zAgent = P("HTTP_USER_AGENT");
  if( zAgent==0 ) return 0;
  if( sqlite3_strglob("*droid*", zAgent)==0 ) return 1;
  if( sqlite3_strglob("*mobile*", zAgent)==0 ) return 1;
  if( sqlite3_strglob("*iOS*", zAgent)==0 ) return 1;
  if( sqlite3_strglob("*iPhone*", zAgent)==0 ) return 1;
  return 0;
}

/*
** COMMAND: test-ishuman
**
** Read lines of text from standard input.  Interpret each line of text







>
>
>
>




<
<
|
<







431
432
433
434
435
436
437
438
439
440
441
442
443
444
445


446

447
448
449
450
451
452
453

/*
** Make a guess at whether or not the requestor is a mobile device or
** a desktop device (narrow screen vs. wide screen) based the HTTP_USER_AGENT
** parameter.  Return true for mobile and false for desktop.
**
** Caution:  This is only a guess.
**
** Algorithm derived from https://developer.mozilla.org/en-US/docs/Web/
** HTTP/Browser_detection_using_the_user_agent#mobile_device_detection on
** 2021-03-01
*/
int user_agent_is_likely_mobile(void){
  const char *zAgent = P("HTTP_USER_AGENT");
  if( zAgent==0 ) return 0;


  if( strstr(zAgent,"Mobi")!=0 ) return 1;

  return 0;
}

/*
** COMMAND: test-ishuman
**
** Read lines of text from standard input.  Interpret each line of text