Skip to content

Commit 65a94ae

Browse files
committed
Improved logged in members section
1 parent 6a93b3a commit 65a94ae

File tree

13 files changed

+65
-18
lines changed

13 files changed

+65
-18
lines changed

.github/workflows/deploy-theme.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
name: deploy-theme
22
on:
33
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
47
permissions:
58
contents: read
69
jobs:
710
deploy:
11+
if: ${{ github.event_name == 'push' && github.actor == 'ngeorger' || github.event_name == 'workflow_dispatch' && github.actor == 'ngeorger' }}
812
runs-on: ubuntu-latest
913
steps:
1014
-
@@ -22,5 +26,5 @@ jobs:
2226
with:
2327
api-url: ${{ secrets.GHOST_API_URL }}
2428
api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}
25-
exclude: "node_modules gulpfile.js yarn.lock .gitignore .github .git LICENSE README.md .pre-commit-config.yaml routes.yaml tailwind.config.js .nvmrc "
29+
exclude: "node_modules gulpfile.js yarn.lock .gitignore .github .git LICENSE README.md .pre-commit-config.yaml routes.yaml tailwind.config.js"
2630

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/built/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/built/prism.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/built/screen.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/main.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,23 @@ document.addEventListener('DOMContentLoaded', function () {
7070
wrapper.appendChild(table);
7171
});
7272
})();
73+
74+
/* Open external links in new tab */
75+
const domain = window.location.host.replace(/^www\./i, '');
76+
const links = document.querySelectorAll('a[href]');
77+
78+
links.forEach((link) => {
79+
try {
80+
const href = link.href.toLowerCase();
81+
// Skip empty links or potentially malicious javascript: URLs
82+
if (!href || /^javascript:/i.test(href)) return;
83+
84+
// Check if link is external
85+
if (!href.includes(domain) || href.includes(`ref=${domain}`)) {
86+
link.setAttribute('target', '_blank');
87+
link.setAttribute('rel', 'noopener');
88+
}
89+
} catch (error) {
90+
console.warn('Error processing link:', error);
91+
}
92+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "sredevopsorg-ghost-theme",
33
"description": "Ghost v5 Theme made for SREDevOps.org (https://sredevops.org) based on Tailwind CSS v3, responsive, dark color schema, SVG icons, sidebar + footer navgation, customized tags and recommendations pages.",
44
"demo": "https://sredevops.org",
5-
"version": "1.1.4",
5+
"version": "1.1.5",
66
"engines": {
77
"ghost": ">=5.0.0"
88
},

partials/algolia.hbs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@
77
};
88
document.head.appendChild(script);
99
}
10+
11+
// Add event listener for ESC key
12+
document.addEventListener('keydown', function(event) {
13+
if (event.key === 'Escape') {
14+
closeModal();
15+
}
16+
});
1017
</script>
11-
18+
1219
<div id="searchModal" class="modal">
1320
<div class="modal-content">
1421

partials/components/nav.hbs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,29 @@
6060
</section>
6161
<section id="members" class="pb-4 text-light">
6262
{{#if @member}}
63+
{{!-- Add CryptoJS library --}}
64+
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
65+
<script>
66+
document.addEventListener('DOMContentLoaded', () => {
67+
// Step 1: Hash your email address using SHA-256.
68+
const hashedEmail = CryptoJS.SHA256('{{@member.email}}').toString(); // Add toString()
69+
// Step 2: Construct the Gravatar URL.
70+
const gravatarUrl = `https://www.gravatar.com/avatar/${hashedEmail}`;
71+
// Step 3: Set the image source to the Gravatar URL.
72+
document.getElementById('gravatar-image').src = gravatarUrl;
73+
});
74+
</script>
6375
<div class="flex items-center gap-2">
6476
<ul>
65-
<li><a href="/#/portal/account/profile"><img src="{{@member.avatar}}" alt="{{@member.name}} Settings" aria-label="{{@member.name}} Settings" class="w-8 h-8 rounded-full"></a></li>
66-
<li><a href="javascript:" data-members-signout>Sign out</a></li>
77+
<li><img alt="{{@member.name}}" aria-label="Avatar" class="w-10 h-10 rounded-full" id="gravatar-image"></li>
78+
<li><span class="text-xs text-light">Welcome, {{@member.name}}</span></li>
79+
<li><a href="/#/portal/account/profile" data-portal="account/profile" class="text-xs text-light">Settings</a></li>
80+
<li><a href="https://gravatar.com/profile" target="_blank" rel="noopener nofollow" class="text-xs text-light">Edit your avatar</a></li>
81+
<li><a href="javascript:" data-members-signout class="text-xs text-light">Sign out</a></li>
6782
</ul>
6883
</div>
6984
{{else}}
70-
{{> "social-sso"}}
85+
{{> "social-sso"}}
7186
{{/if}}
7287
</section>
7388
</aside>

partials/feature-image.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</picture>
1313
{{#unless "post" }}
1414
{{#if feature_image_caption}}
15-
<figcaption>{{feature_image_caption}}</figcaption>
15+
<figcaption class="text-xs text-center text-light">{{feature_image_caption}}</figcaption>
1616
{{/if}}
1717
{{/unless}}
1818
</figure>

0 commit comments

Comments
 (0)