Skip to content

Commit 02c9ab1

Browse files
committed
better html page
1 parent 117f2d4 commit 02c9ab1

1 file changed

Lines changed: 22 additions & 8 deletions

File tree

oauth-callback.html

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,27 +107,41 @@ <h1>✅ Authentication Successful!</h1>
107107
<script>
108108
(function() {
109109
try {
110-
// Extract OAuth parameters from URL hash (not search string)
111-
// OAuth providers redirect with params in the hash fragment
110+
// extract OAuth parameters from URL hash (not search string)
112111
const params = new URLSearchParams(window.location.hash.slice(1));
113112

114-
// Build Obsidian URI with all OAuth callback parameters
115113
const obsidianUri = `obsidian://atmosphere-oauth?${params.toString()}`;
116114

117-
// Store the URI for manual copy
115+
// store the URI for manual copy
118116
document.getElementById('link-text').textContent = obsidianUri;
119117

120-
// Attempt automatic redirect
121118
window.location.href = obsidianUri;
122119

123-
// Show manual instructions after a delay if redirect didn't work
124120
setTimeout(function() {
125-
document.getElementById('status').textContent = 'Having trouble redirecting?';
121+
const spinner = document.querySelector('.spinner');
122+
if (spinner) spinner.style.display = 'none';
123+
124+
// Show success message
125+
document.querySelector('h1').textContent = '✅ Redirected!';
126+
document.getElementById('status').textContent = 'Return to Obsidian to complete login.';
127+
128+
setTimeout(function() {
129+
try {
130+
window.close();
131+
} catch (e) {
132+
document.getElementById('status').textContent = 'You can close this window now.';
133+
}
134+
}, 500);
135+
}, 500);
136+
137+
// show manual instructions after a longer delay if still open
138+
setTimeout(function() {
126139
document.getElementById('manual-link').classList.add('show');
127-
}, 2000);
140+
}, 3000);
128141

129142
} catch (error) {
130143
console.error('Redirect error:', error);
144+
document.querySelector('.spinner').style.display = 'none';
131145
document.getElementById('status').textContent = 'An error occurred during redirect';
132146
document.getElementById('manual-link').classList.add('show');
133147
}

0 commit comments

Comments
 (0)