<p dir="auto">Two changes:</p>
<ul dir="auto">
<li>DRY up the code handling JS cookies.
<ul dir="auto">
<li>It's very repetitive as every single instance repeats the arguments <code class="notranslate">{ secure: true, path: "/", samesite: "lax" }</code>.</li>
<li>We can avoid this using <code class="notranslate">Cookies.withAttributes</code>, creating a preset that I have placed at <code class="notranslate">OSM.cookies</code>.</li>
<li>Argument <code class="notranslate">expires</code> left in place as it does change in each instance.</li>
</ul>
</li>
<li>Change <code class="notranslate">secure: true</code> to only apply when HTTPS is expected. This is, when <code class="notranslate">Settings.server_protocol == "https"</code>.</li>
</ul>
<p dir="auto">This change is extracted from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3474165426" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/6424" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/6424/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/6424">#6424</a>. Over there it was done so that system tests work with remote Selenium.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/6430'>https://github.com/openstreetmap/openstreetmap-website/pull/6430</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/6430/commits/ea1523023525d2fba785adccaf5899339923aba1" class="commit-link">ea15230</a>  DRY up cookie handling</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/6430/commits/8f7fadf98151511defbeb49b1a3b5e0858a4eecb" class="commit-link">8f7fadf</a>  Secure cookies only when HTTPS expected</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/6430/files">5 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6430/files#diff-cdc070ced1c4000efd1e28357fd26b2fd617d7fccfeae0324222231db75dd6ee">app/assets/javascripts/index.js</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6430/files#diff-fdb9558c2ba79ddf9fbcb92594a8a8fa54abb1b3e25ce264de37951b428a958b">app/assets/javascripts/index/directions.js</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6430/files#diff-08fd2f80528286cf96375b12d81cac98954dee8e6a6899f5f261a127861fdd49">app/assets/javascripts/index/new_note.js</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6430/files#diff-f3d75a429346b0f71a92922e7bdc526c74f6211947050df3d331c05d3019e5b8">app/assets/javascripts/language_selector.js</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6430/files#diff-a9b88a8a3644f944b9bd54361da588c69fa6a210cf7327194c17895a8ad2b0d6">app/assets/javascripts/osm.js.erb</a>
    (4)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/6430.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/6430.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/6430.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/6430.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6430">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLKIAFWZIKMGDHVMEAT3WKIPFAVCNFSM6AAAAACINRVVRGVHI2DSMVQWIX3LMV43ASLTON2WKOZTGQ4DQMBTGQYTGMA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLI45PN2AMC6UADBQ4D3WKIPFA5CNFSM6AAAAACINRVVRGWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHM7ZZNKI.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/6430</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/6430",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/6430",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>