Got working with nostr-login

This commit is contained in:
Your Name
2025-08-18 13:59:12 -04:00
parent 86e403ab5f
commit 527e01b3e8
5 changed files with 30 additions and 43 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
nostr-login/

1
nostr-login Submodule

Submodule nostr-login added at a679422d07

View File

@@ -2,9 +2,6 @@
"folders": [
{
"path": "."
},
{
"path": "../nostr-login"
}
],
"settings": {

4
upload.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
rsync -avz ./app.js ubuntu@laantungir.net:~/nostr-oidc-bridge/app.js
rsync -avz ./views/login.ejs ubuntu@laantungir.net:~/nostr-oidc-bridge/views/

View File

@@ -3,7 +3,13 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nostr Login - OIDC Bridge v2.2</title>
<title>OIDC Bridge v2.4</title>
<style>
body {
background: black
}
</style>
</head>
<body>
<div id="login-container">
@@ -19,22 +25,19 @@
</div>
<% } %>
<!-- Version header -->
<div style="text-align: center; margin: 10px 0; padding: 8px; background: #e3f2fd; border: 1px solid #2196f3; border-radius: 4px; font-weight: bold; color: #1976d2;">
🚀 Nostr OIDC Bridge v2.2 - Fixed npub scope + relay update
</div>
<!-- Target div for nostr-login widget -->
<div id="nostr-login"></div>
<!-- Version info -->
<div style="position: fixed; bottom: 10px; right: 10px; font-size: 14px; color: #333; background: rgba(255,255,255,0.95); padding: 6px 12px; border-radius: 6px; border: 1px solid #ddd; font-weight: bold;">
v2.2 - Fixed npub scope + relay update
</div>
</div>
<!-- Load your hosted nostr-login with full permissions -->
<script src='https://laantungir.net/nostr-login/unpkg.js'></script>
<!-- Load your hosted nostr-login with custom laan theme configuration -->
<script src='https://laantungir.net/nostr-login/unpkg.js'
data-theme='laan'
data-start-screen='welcome'
data-no-banner='true'></script>
<!-- Import nostr-tools for proper npub encoding -->
<script type="module">
@@ -46,35 +49,16 @@
<script>
let isProcessing = false;
// Initialize nostr-login widget
window.addEventListener('DOMContentLoaded', () => {
console.log('Initializing nostr-login widget...');
// Create nostr-login options
const nostrLoginOptions = {
bunkers: 'all',
methods: 'all',
noBanner: true,
startScreen: 'welcome-login',
theme: 'default'
};
console.log('nostr-login options', nostrLoginOptions);
// Initialize the widget
if (window.NostrLogin) {
window.NostrLogin.init(nostrLoginOptions);
} else {
console.error('NostrLogin not found on window object');
// Fallback: try to initialize after a delay
setTimeout(() => {
if (window.NostrLogin) {
console.log('Retrying NostrLogin initialization...');
window.NostrLogin.init(nostrLoginOptions);
}
}, 1000);
}
// Widget initialization is now handled automatically by the script data attributes
console.log('Nostr-login widget will initialize automatically with laan theme and immediate login display');
// Auto-launch the login modal immediately when page loads
window.addEventListener('load', () => {
// Small delay to ensure nostr-login widget is fully initialized
setTimeout(() => {
console.log('Auto-launching nostr-login modal...');
document.dispatchEvent(new CustomEvent('nlLaunch', { detail: 'login' }));
}, 100);
});
// Listen for nostr-login authentication events