Compare commits
1 Commits
mimo/code/
...
mimo/creat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
571475a749 |
@@ -1,4 +1,4 @@
|
|||||||
const giteaApiUrl = 'https://forge.alexanderwhitestone.com/api/v1';
|
const GiteaApiUrl = 'https://forge.alexanderwhitestone.com/api/v1';
|
||||||
const token = process.env.GITEA_TOKEN; // Should be stored securely in environment variables
|
const token = process.env.GITEA_TOKEN; // Should be stored securely in environment variables
|
||||||
const repos = ['hermes-agent', 'the-nexus', 'timmy-home', 'timmy-config'];
|
const repos = ['hermes-agent', 'the-nexus', 'timmy-home', 'timmy-config'];
|
||||||
|
|
||||||
@@ -13,6 +13,31 @@ const branchProtectionSettings = {
|
|||||||
// Special handling for the-nexus (CI disabled)
|
// Special handling for the-nexus (CI disabled)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function applyBranchProtection(repo) {
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${giteaApiUrl}/repos/Timmy_Foundation/${repo}/branches/main/protection`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Authorization': `token ${token}`,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
...branchProtectionSettings,
|
||||||
|
// Special handling for the-nexus (CI disabled)
|
||||||
|
requiredStatusChecks: repo === 'the-nexus' ? false : true
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to apply branch protection to ${repo}: ${await response.text()}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`✅ Branch protection applied to ${repo}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`❌ Error applying branch protection to ${repo}: ${error.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function applyBranchProtection(repo) {
|
async function applyBranchProtection(repo) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${giteaApiUrl}/repos/Timmy_Foundation/${repo}/branches/main/protection`, {
|
const response = await fetch(`${giteaApiUrl}/repos/Timmy_Foundation/${repo}/branches/main/protection`, {
|
||||||
|
|||||||
17
server.py
17
server.py
@@ -52,19 +52,20 @@ async def broadcast_handler(websocket: websockets.WebSocketServerProtocol):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
disconnected = set()
|
disconnected = set()
|
||||||
# Create broadcast tasks for efficiency
|
# Create broadcast tasks, tracking which client each task targets
|
||||||
tasks = []
|
task_client_pairs = []
|
||||||
for client in clients:
|
for client in clients:
|
||||||
if client != websocket and client.open:
|
if client != websocket and client.open:
|
||||||
tasks.append(asyncio.create_task(client.send(message)))
|
task = asyncio.create_task(client.send(message))
|
||||||
|
task_client_pairs.append((task, client))
|
||||||
if tasks:
|
|
||||||
|
if task_client_pairs:
|
||||||
|
tasks = [pair[0] for pair in task_client_pairs]
|
||||||
results = await asyncio.gather(*tasks, return_exceptions=True)
|
results = await asyncio.gather(*tasks, return_exceptions=True)
|
||||||
for i, result in enumerate(results):
|
for i, result in enumerate(results):
|
||||||
if isinstance(result, Exception):
|
if isinstance(result, Exception):
|
||||||
# Find the client that failed
|
target_client = task_client_pairs[i][1]
|
||||||
target_client = [c for c in clients if c != websocket][i]
|
logger.error(f"Failed to send to client {target_client.remote_address}: {result}")
|
||||||
logger.error(f"Failed to send to a client {target_client.remote_address}: {result}")
|
|
||||||
disconnected.add(target_client)
|
disconnected.add(target_client)
|
||||||
|
|
||||||
if disconnected:
|
if disconnected:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const ASSETS_TO_CACHE = [
|
|||||||
|
|
||||||
self.addEventListener('install', (event) => {
|
self.addEventListener('install', (event) => {
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
caches.open(CACHE_NAME).then(cache => {
|
caches.open(CachedName).then(cache => {
|
||||||
return cache.addAll(ASSETS_TO_CACHE);
|
return cache.addAll(ASSETS_TO_CACHE);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user