Skip to content

Commit

Permalink
We are going back to vanilla...
Browse files Browse the repository at this point in the history
  • Loading branch information
nishimi-ya committed Dec 14, 2024
1 parent e74f79b commit 3556b25
Show file tree
Hide file tree
Showing 14 changed files with 176 additions and 1,378 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
25 changes: 0 additions & 25 deletions .gitignore

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Nishimiya

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# nishimi-ya.github.io
Binary file added favicon.ico
Binary file not shown.
124 changes: 111 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">

<head>
Expand All @@ -9,7 +9,7 @@
<meta property="og:title" content="Nishimiya's Homepage" />
<meta property="og:description" content="Welcome aboard to Nishimiya's base station." />
<meta property="og:image"
content="https://raw.githubusercontent.com/nishimi-ya/nishimi-ya.github.io/main/public/tenshi.png" />
content="https://raw.githubusercontent.com/nishimi-ya/nishimi-ya.github.io/main/tenshi.png" />
<meta name="author" content="Nishimiya" />
<meta name="keywords" content="libre, landing page, social, website" />
<meta property="og:url" content="https://nishimiya.my.id" />
Expand All @@ -19,9 +19,6 @@
<link rel="me" href="https://github.com/nishimi-ya" />
<link rel="me" href="https://layer8.space/@Nishimiya" />
<link rel="shortcut icon" href="./favicon.ico" />
<<<<<<< HEAD
<link rel="stylesheet" href="./src/style.css" />
=======

<style>
/* Basic Reset */
Expand Down Expand Up @@ -153,10 +150,11 @@
/* Firefox */
-ms-overflow-style: none;
/* IE and Edge */
scroll-snap-type: x smooth; /* Changed from mandatory to smooth */
scroll-snap-type: x smooth;
/* Changed from mandatory to smooth */
scroll-behavior: smooth;
/* Other styles */
}
/* Other styles */
}
}

.rss-feed-container::-webkit-scrollbar {
Expand Down Expand Up @@ -266,7 +264,6 @@
}
}
</style>
>>>>>>> parent of b7505e3 (Fix the <a> tag in matrix link)
</head>

<body class="dark-mode">
Expand Down Expand Up @@ -297,7 +294,7 @@ <h2>## Social links and stuff</h2>
<li>Mastodon: <a rel="me" href="https://layer8.space/@nishimiya">@[email protected]</a></li>
<li>Soulseek: @nishi26</li>
<li>Email: <a href="mailto:[email protected]">[email protected]</a></li>
<li>Matrix: <a href="https://matrix.to/#/#nishimiya:matrix.org" </a>nishimiya:matrix.org</li>
<li>Matrix: <a href="https://matrix.to/#/#nishimiya:matrix.org">nishimiya:matrix.org</a></li>
</ul>

<h2>## Projects</h2>
Expand Down Expand Up @@ -342,8 +339,109 @@ <h3>### Misc</h3>
<h2>## Recent Blog Posts</h2>
<div class="rss-feed-container" id="rss-feed"></div>
</div>
<script type="module" src="./src/main.js"></script>
<script type="module" src="./src/rss.js"></script>
<script type="module" src="./src/scrobble.js"></script>


<script>
// Theme Toggle Function
function toggleTheme() {
document.body.classList.toggle("light-mode");
const themeToggleButton = document.querySelector('.theme-toggle');
if (document.body.classList.contains("light-mode")) {
themeToggleButton.textContent = "Dark Mode";
themeToggleButton.classList.remove("light");
} else {
themeToggleButton.textContent = "Light Mode";
themeToggleButton.classList.add("light");
}
}

// Truncate Titles Function
function truncateTitles() {
const titles = document.querySelectorAll('.rss-feed-item h3');
titles.forEach(function (title) {
const words = title.textContent.split(' ');
if (words.length > 6) {
const truncatedTitle = words.slice(0, 6).join(' ') + '...';
title.textContent = truncatedTitle;
}
});
}

// Fetch the RSS feed XML and display titles and content
async function loadRSSFeed() {
try {
const response = await fetch('https://blog.nishimiya.my.id/index.xml');
const xmlText = await response.text();

const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlText, "text/xml");

const items = xmlDoc.getElementsByTagName("item");
const rssContainer = document.getElementById("rss-feed");
rssContainer.innerHTML = '';

for (let i = 0; i < Math.min(items.length, 5); i++) {
const titleElement = items[i].getElementsByTagName("title")[0];
const titleText = titleElement.textContent;
const pubDateElement = items[i].getElementsByTagName("pubDate")[0];
const pubDateText = new Date(pubDateElement.textContent).toLocaleDateString('en-US', {weekday: 'long', year: 'numeric', month: 'short', day: 'numeric'});

const linkElement = items[i].getElementsByTagName("link")[0];
const linkUrl = linkElement.textContent;

const rssItem = document.createElement("div");
rssItem.className = "rss-feed-item";

const linkTag = document.createElement("a");
linkTag.href = linkUrl;
linkTag.target = "_blank";
linkTag.innerHTML = `
<h3>${titleText}</h3>
<p>${pubDateText}</p>
`;
rssItem.appendChild(linkTag);
rssContainer.appendChild(rssItem);
}
} catch (error) {
console.error("Failed to load RSS feed:", error);
}
}

const apiKey = '100ef39a2373fb82830e075325bebef7'; // Replace with your Last.fm API key
const username = 'nishi-miya'; // Replace with your Last.fm username

const fetchRecentTracks = async () => {
const songStatusElement = document.getElementById('song-status');

try {
const response = await fetch(`https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${username}&api_key=${apiKey}&format=json`);
const {recenttracks: {track = []} = {}} = await response.json();

if (track.length > 0) {
const {name: songName, artist, album} = track[0];
songStatusElement.innerHTML = `
🎧 Last Played: <span>${songName}</span> by ${artist['#text']} (Album: ${album?.['#text'] || 'Unknown Album'})
`;
} else {
songStatusElement.innerText = "No recent tracks found.";
}
} catch (error) {
console.error("Error fetching Last.fm data:", error);
songStatusElement.innerText = "Failed to fetch song data.";
}
};

// Fetch recent track on page load
fetchRecentTracks();

// Poll every 30 seconds to keep the status up to date
setInterval(fetchRecentTracks, 30000);

// Load RSS feed on page load
loadRSSFeed().then(function () {
truncateTitles();
});
</script>
</body>

</html>
12 changes: 0 additions & 12 deletions netlify.toml

This file was deleted.

Loading

0 comments on commit 3556b25

Please sign in to comment.