mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 20:36:07 +01:00 
			
		
		
		
	@@ -1,5 +1,5 @@
 | 
			
		||||
import {encodeURLEncodedBase64, decodeURLEncodedBase64} from '../utils.ts';
 | 
			
		||||
import {showElem} from '../utils/dom.ts';
 | 
			
		||||
import {hideElem, showElem} from '../utils/dom.ts';
 | 
			
		||||
import {GET, POST} from '../modules/fetch.ts';
 | 
			
		||||
 | 
			
		||||
const {appSubUrl} = window.config;
 | 
			
		||||
@@ -11,6 +11,15 @@ export async function initUserAuthWebAuthn() {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (window.location.protocol === 'http:') {
 | 
			
		||||
    // webauthn is only supported on secure contexts
 | 
			
		||||
    const isLocalhost = ['localhost', '127.0.0.1'].includes(window.location.hostname);
 | 
			
		||||
    if (!isLocalhost) {
 | 
			
		||||
      hideElem(elSignInPasskeyBtn);
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (!detectWebAuthnSupport()) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user