diff --git a/.gitignore b/.gitignore
index b65ab76..7303891 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,32 +8,82 @@
ehthumbs.db
Thumbs.db
nohup.out
+*.tmp
+*.temp
-# Python files #
+# Environment files #
######################
-.python-version
.env
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+.python-version
.venv
.ipynb_checkpoints
+
+# Logs #
+######################
*.log
-
-# Editor files #
-######################
-.idea
-.vscode
-
-# Node files #
-######################
-node_modules/
-dist/
+logs/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+lerna-debug.log*
+.pnpm-debug.log*
+
+# Editor files #
+######################
+.idea/
+.vscode/
+*.swp
+*.swo
+*~
+.vim/
+.emacs.d/
+.sublime-*
+
+# Node.js #
+######################
+node_modules/
+dist/
+build/
+coverage/
+.nyc_output/
+.cache/
+.parcel-cache/
+.next/
+.nuxt/
+.vuepress/dist/
+.serverless/
+.fusebox/
+.dynamodb/
+.tern-port
package-lock.json
+# Testing #
+######################
+.jest/
+.coverage/
+junit.xml
+test-results/
-# Other files #
+# Build artifacts #
######################
themes/coo/source/css/style.css
public/
db.json
+*.tgz
+*.tar.gz
+
+# Security #
+######################
+.npmrc
+.yarnrc
+.pnpm-store/
+
+# Misc #
+######################
+.eslintcache
+.stylelintcache
+.prettierignore
diff --git a/README.md b/README.md
index 034db61..1af2be8 100644
--- a/README.md
+++ b/README.md
@@ -404,7 +404,7 @@ Only the `title` and `intro` fields are required, and the other options can be l
Stay up-to-date with our project by following us on Twitter! Get all the latest news and updates right in your feed.
It's the perfect way to stay in the loop.
-
+
## 📃 License
diff --git a/package.json b/package.json
index 2da6a95..ab26bb0 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,11 @@
"lint:check": "eslint themes/coo/source/js/**/*.js",
"lint:css": "stylelint **/*.css --fix",
"test": "run-s lint:check format:check",
+ "audit": "pnpm audit --audit-level moderate",
+ "audit:fix": "pnpm audit --fix",
+ "security:check": "pnpm audit && pnpm outdated",
+ "deps:check": "npx npm-check-updates",
+ "deps:update": "npx npm-check-updates -u && pnpm install",
"prepare": "husky",
"commit": "cz"
},
diff --git a/source/_posts/latex.md b/source/_posts/latex.md
index 70e2f45..689dec4 100644
--- a/source/_posts/latex.md
+++ b/source/_posts/latex.md
@@ -200,7 +200,7 @@ Example based on KaTeX showing on one line: `KaTeX:\int_0^\infty x^2 dx`
### `KaTeX:\LaTeX` math constructs {.col-span-3}
-| 预览 | 方法 | 预览 | 方法 | 预览 | 方法 |
+| Preview | Method | Preview | Method | Preview | Method |
| :---------------------- | :--------------------------- | :---------------------- | :--------------------------- | :--------------------------- | :-------------------------------- |
| `KaTeX:\frac{abc}{xyz}` | `\frac{abc}{xyz}` | `KaTeX:\overline{abc}` | `\overline{abc}` | `KaTeX:\overrightarrow{abc}` | `\overrightarrow{abc}` |
| `KaTeX:f'` | `f'` | `KaTeX:\underline{abc}` | `\underline{abc}` | `KaTeX:\overleftarrow{abc}` | `\overleftarrow{abc}` |
@@ -481,7 +481,7 @@ The pair of expressions `\left` `KaTeX:s_1` and `\right` `KaTeX:s_2` can be used
{.left-align}
-### 可扩展箭头 {.col-span-3}
+### Extensible arrows {.col-span-3}
| :- | :- | :- | :- |
| :------------------------------- | :------------------------------------ | :-------------------------------- | :------------------------------------- |
diff --git a/source/_posts/ruby.md b/source/_posts/ruby.md
index 10803dc..92da6af 100644
--- a/source/_posts/ruby.md
+++ b/source/_posts/ruby.md
@@ -449,7 +449,7 @@ case input
# Check for an integer, 19
when 19
puts "It's 19"
- # 检查一个确切的字符串,“Zaman”
+ # Check for an exact string,“Zaman”
when "Zaman"
puts "Hi Zaman"
when 7..11
diff --git a/source/assets/logo/icon-128x128.png b/source/assets/logo/icon-128x128.png
new file mode 100644
index 0000000..3ff072c
Binary files /dev/null and b/source/assets/logo/icon-128x128.png differ
diff --git a/source/assets/logo/icon-144x144.png b/source/assets/logo/icon-144x144.png
new file mode 100644
index 0000000..da4f02d
Binary files /dev/null and b/source/assets/logo/icon-144x144.png differ
diff --git a/source/assets/logo/icon-152x152.png b/source/assets/logo/icon-152x152.png
new file mode 100644
index 0000000..41ebf65
Binary files /dev/null and b/source/assets/logo/icon-152x152.png differ
diff --git a/source/assets/logo/icon-192x192.png b/source/assets/logo/icon-192x192.png
new file mode 100644
index 0000000..74100d2
Binary files /dev/null and b/source/assets/logo/icon-192x192.png differ
diff --git a/source/assets/logo/icon-384x384.png b/source/assets/logo/icon-384x384.png
new file mode 100644
index 0000000..aba3bb3
Binary files /dev/null and b/source/assets/logo/icon-384x384.png differ
diff --git a/source/assets/logo/icon-512x512.png b/source/assets/logo/icon-512x512.png
new file mode 100644
index 0000000..afaf4b5
Binary files /dev/null and b/source/assets/logo/icon-512x512.png differ
diff --git a/source/assets/logo/icon-72x72.png b/source/assets/logo/icon-72x72.png
new file mode 100644
index 0000000..e29faaf
Binary files /dev/null and b/source/assets/logo/icon-72x72.png differ
diff --git a/source/assets/logo/icon-96x96.png b/source/assets/logo/icon-96x96.png
new file mode 100644
index 0000000..9251497
Binary files /dev/null and b/source/assets/logo/icon-96x96.png differ
diff --git a/source/assets/logo/logo.png b/source/assets/logo/logo.png
new file mode 100644
index 0000000..467fb6c
Binary files /dev/null and b/source/assets/logo/logo.png differ
diff --git a/source/assets/logo/logo.svg b/source/assets/logo/logo.svg
new file mode 100644
index 0000000..0cb9589
--- /dev/null
+++ b/source/assets/logo/logo.svg
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/source/assets/screenshots/desktop-1280x720.png b/source/assets/screenshots/desktop-1280x720.png
new file mode 100644
index 0000000..25fbad5
Binary files /dev/null and b/source/assets/screenshots/desktop-1280x720.png differ
diff --git a/source/assets/screenshots/mobile-390x844.png b/source/assets/screenshots/mobile-390x844.png
new file mode 100644
index 0000000..8287d4a
Binary files /dev/null and b/source/assets/screenshots/mobile-390x844.png differ
diff --git a/source/manifest.json b/source/manifest.json
new file mode 100644
index 0000000..7709856
--- /dev/null
+++ b/source/manifest.json
@@ -0,0 +1,105 @@
+{
+ "name": "CheatSheets.zip - Ultimate Cheat Sheets for Developers",
+ "short_name": "CheatSheets",
+ "description": "Share quick reference and cheat sheet for developers",
+ "start_url": "/",
+ "display": "standalone",
+ "background_color": "#ffffff",
+ "theme_color": "#10b981",
+ "orientation": "portrait-primary",
+ "scope": "/",
+ "lang": "en",
+ "categories": ["productivity", "developer", "reference"],
+ "icons": [
+ {
+ "src": "/assets/logo/icon-72x72.png",
+ "sizes": "72x72",
+ "type": "image/png",
+ "purpose": "maskable any"
+ },
+ {
+ "src": "/assets/logo/icon-96x96.png",
+ "sizes": "96x96",
+ "type": "image/png",
+ "purpose": "maskable any"
+ },
+ {
+ "src": "/assets/logo/icon-128x128.png",
+ "sizes": "128x128",
+ "type": "image/png",
+ "purpose": "maskable any"
+ },
+ {
+ "src": "/assets/logo/icon-144x144.png",
+ "sizes": "144x144",
+ "type": "image/png",
+ "purpose": "maskable any"
+ },
+ {
+ "src": "/assets/logo/icon-152x152.png",
+ "sizes": "152x152",
+ "type": "image/png",
+ "purpose": "maskable any"
+ },
+ {
+ "src": "/assets/logo/icon-192x192.png",
+ "sizes": "192x192",
+ "type": "image/png",
+ "purpose": "maskable any"
+ },
+ {
+ "src": "/assets/logo/icon-384x384.png",
+ "sizes": "384x384",
+ "type": "image/png",
+ "purpose": "maskable any"
+ },
+ {
+ "src": "/assets/logo/icon-512x512.png",
+ "sizes": "512x512",
+ "type": "image/png",
+ "purpose": "maskable any"
+ }
+ ],
+ "screenshots": [
+ {
+ "src": "/assets/screenshots/desktop-1280x720.png",
+ "sizes": "1280x720",
+ "type": "image/png",
+ "form_factor": "wide",
+ "label": "Desktop view of CheatSheets.zip"
+ },
+ {
+ "src": "/assets/screenshots/mobile-390x844.png",
+ "sizes": "390x844",
+ "type": "image/png",
+ "form_factor": "narrow",
+ "label": "Mobile view of CheatSheets.zip"
+ }
+ ],
+ "shortcuts": [
+ {
+ "name": "Search Cheat Sheets",
+ "short_name": "Search",
+ "description": "Quickly search through all cheat sheets",
+ "url": "/?q=",
+ "icons": [
+ {
+ "src": "/assets/logo/icon-96x96.png",
+ "sizes": "96x96"
+ }
+ ]
+ },
+ {
+ "name": "Popular Cheat Sheets",
+ "short_name": "Popular",
+ "description": "View most popular cheat sheets",
+ "url": "/#popular",
+ "icons": [
+ {
+ "src": "/assets/logo/icon-96x96.png",
+ "sizes": "96x96"
+ }
+ ]
+ }
+ ]
+}
diff --git a/source/sw.js b/source/sw.js
new file mode 100644
index 0000000..ade65c4
--- /dev/null
+++ b/source/sw.js
@@ -0,0 +1,299 @@
+// CheatSheets.zip Service Worker
+const STATIC_CACHE = 'cheatsheets-static-v1';
+const DYNAMIC_CACHE = 'cheatsheets-dynamic-v1';
+
+// Static assets to cache
+const STATIC_ASSETS = [
+ '/',
+ '/css/style.css',
+ '/js/main.js',
+ '/js/fuse_6.4.6.js',
+ '/manifest.json',
+ '/search.json'
+];
+
+// Page patterns to cache
+const CACHE_PATTERNS = [
+ /^\/$/, // Home page
+ /^\/[a-z-]+\.html$/, // Cheat sheet pages
+ /^\/assets\//, // Static assets
+ /^\/css\//, // CSS files
+ /^\/js\//, // JavaScript files
+ /^\/images\// // Image files
+];
+
+// Service Worker installevent
+self.addEventListener('install', (event) => {
+ // eslint-disable-next-line no-console
+ console.log('Service Worker: Installing...');
+
+ event.waitUntil(
+ caches
+ .open(STATIC_CACHE)
+ .then((cache) => {
+ // eslint-disable-next-line no-console
+ console.log('Service Worker: Caching static assets');
+ return cache.addAll(STATIC_ASSETS);
+ })
+ .then(() => {
+ // eslint-disable-next-line no-console
+ console.log('Service Worker: Static assets cached');
+ return self.skipWaiting();
+ })
+ .catch((error) => {
+ // eslint-disable-next-line no-console
+ console.error('Service Worker: Cache failed', error);
+ })
+ );
+});
+
+// Service Worker activate event
+self.addEventListener('activate', (event) => {
+ // eslint-disable-next-line no-console
+ console.log('Service Worker: Activating...');
+
+ event.waitUntil(
+ caches
+ .keys()
+ .then((cacheNames) => {
+ return Promise.all(
+ cacheNames.map((cacheName) => {
+ // Delete old cache versions
+ if (cacheName !== STATIC_CACHE && cacheName !== DYNAMIC_CACHE) {
+ // eslint-disable-next-line no-console
+ console.log('Service Worker: Deleting old cache', cacheName);
+ return caches.delete(cacheName);
+ }
+ })
+ );
+ })
+ .then(() => {
+ // eslint-disable-next-line no-console
+ console.log('Service Worker: Activated');
+ return self.clients.claim();
+ })
+ );
+});
+
+// Network request interception
+self.addEventListener('fetch', (event) => {
+ const { request } = event;
+ const url = new URL(request.url);
+
+ // Only handle same-origin requests
+ if (url.origin !== location.origin) {
+ return;
+ }
+
+ // Check if matches cache pattern
+ const shouldCache = CACHE_PATTERNS.some((pattern) => pattern.test(url.pathname));
+
+ if (shouldCache) {
+ event.respondWith(handleCacheRequest(request));
+ }
+});
+
+// Cache request handling strategy
+async function handleCacheRequest(request) {
+ const url = new URL(request.url);
+
+ try {
+ // 1. Try to get from cache
+ const cachedResponse = await caches.match(request);
+
+ // 2. If it's a static asset and cached, return directly
+ if (cachedResponse && isStaticAsset(url.pathname)) {
+ return cachedResponse;
+ }
+
+ // 3. Try network request
+ const networkResponse = await fetch(request);
+
+ // 4. If network request succeeds, update cache
+ if (networkResponse.ok) {
+ const cache = await caches.open(DYNAMIC_CACHE);
+ cache.put(request, networkResponse.clone());
+ return networkResponse;
+ }
+
+ // 5. Network failed, return cache (if available)
+ if (cachedResponse) {
+ return cachedResponse;
+ }
+
+ // 6. Nothing available, return offline page
+ return createOfflineResponse(url.pathname);
+ } catch (error) {
+ // eslint-disable-next-line no-console
+ console.error('Service Worker: Fetch failed', error);
+
+ // Network error, try to return cache
+ const cachedResponse = await caches.match(request);
+ if (cachedResponse) {
+ return cachedResponse;
+ }
+
+ // Return offline page
+ return createOfflineResponse(url.pathname);
+ }
+}
+
+// Check if it's a static asset
+function isStaticAsset(pathname) {
+ return /\.(css|js|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/.test(pathname);
+}
+
+// Create offline response
+function createOfflineResponse(pathname) {
+ const isHtmlPage = pathname.endsWith('.html') || pathname === '/';
+
+ if (isHtmlPage) {
+ return new Response(
+ `
+
+
+
+
+
+ Offline - CheatSheets.zip
+
+
+
+
+
📚
+
You're Offline
+
+ This page isn't available offline yet. Please check your internet connection and try again.
+
+
+
+
+
+ `,
+ {
+ status: 200,
+ headers: {
+ 'Content-Type': 'text/html; charset=utf-8',
+ 'Cache-Control': 'no-cache'
+ }
+ }
+ );
+ }
+
+ return new Response('Offline', {
+ status: 503,
+ statusText: 'Service Unavailable'
+ });
+}
+
+// Background sync (if supported)
+if ('sync' in self.registration) {
+ self.addEventListener('sync', (event) => {
+ if (event.tag === 'background-sync') {
+ event.waitUntil(doBackgroundSync());
+ }
+ });
+}
+
+async function doBackgroundSync() {
+ try {
+ // Sync search data
+ const response = await fetch('/search.json');
+ if (response.ok) {
+ const cache = await caches.open(DYNAMIC_CACHE);
+ cache.put('/search.json', response);
+ }
+ } catch (error) {
+ // eslint-disable-next-line no-console
+ console.error('Background sync failed:', error);
+ }
+}
+
+// Push notifications (if needed)
+self.addEventListener('push', (event) => {
+ if (event.data) {
+ const data = event.data.json();
+ const options = {
+ body: data.body,
+ icon: '/assets/icons/icon-192x192.png',
+ badge: '/assets/icons/icon-72x72.png',
+ vibrate: [100, 50, 100],
+ data: {
+ dateOfArrival: Date.now(),
+ primaryKey: data.primaryKey
+ },
+ actions: [
+ {
+ action: 'explore',
+ title: 'View Cheat Sheet',
+ icon: '/assets/icons/icon-96x96.png'
+ },
+ {
+ action: 'close',
+ title: 'Close',
+ icon: '/assets/icons/icon-96x96.png'
+ }
+ ]
+ };
+
+ event.waitUntil(self.registration.showNotification(data.title, options));
+ }
+});
+
+// Notification click handling
+self.addEventListener('notificationclick', (event) => {
+ event.notification.close();
+
+ if (event.action === 'explore') {
+ event.waitUntil(
+ // eslint-disable-next-line no-undef
+ clients.openWindow('/')
+ );
+ }
+});
diff --git a/themes/coo/layout/_partial/head.ejs b/themes/coo/layout/_partial/head.ejs
index 42a365f..6e31481 100644
--- a/themes/coo/layout/_partial/head.ejs
+++ b/themes/coo/layout/_partial/head.ejs
@@ -35,6 +35,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/themes/coo/layout/_partial/index/logo.ejs b/themes/coo/layout/_partial/index/logo.ejs
index 7b99b7e..8eab119 100644
--- a/themes/coo/layout/_partial/index/logo.ejs
+++ b/themes/coo/layout/_partial/index/logo.ejs
@@ -1,12 +1,12 @@
<% if (icon) { %>
-
+
<% } %>
-
cheatsheetscheatsheets.zip
<% if (page.layout == "note" || page._isNotePagination){ %>
diff --git a/themes/coo/layout/_partial/scripts.ejs b/themes/coo/layout/_partial/scripts.ejs
index 8cd3882..68fdb64 100644
--- a/themes/coo/layout/_partial/scripts.ejs
+++ b/themes/coo/layout/_partial/scripts.ejs
@@ -389,3 +389,83 @@
});
<% } %>
+
+
+