Skip to content

Commit

Permalink
Fix "mixed content" error
Browse files Browse the repository at this point in the history
  • Loading branch information
anfragment committed Jun 6, 2024
1 parent 185d1c1 commit c5ad628
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion local-demo/cursors.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion script/dist/cursors.min.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions script/src/cursors.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ import { DEFAULT_API_URL } from './config';

const url = window.location.href.split('?')[0].split('#')[0];

const response = await fetch(`http://${apiURL}/cursors?url=${url}`);
const response = await fetch(
`${url.startsWith('https') ? 'https' : 'http'}://${apiURL}/cursors?url=${url}`
);
const data = await response.json();
for (const cursor of data.cursors || []) {
createCursor(cursor);
}

startWS(
`ws://${apiURL}/subscribe?url=${url}&country=${countryCode}&os=${os}`,
`${url.startsWith('https' ? 'wss' : 'ws')}://${apiURL}/subscribe?url=${url}&country=${countryCode}&os=${os}`,
createCursor,
updateCursor,
deleteCursor
Expand Down

0 comments on commit c5ad628

Please sign in to comment.