Compare commits
6 Commits
v3.0.3
...
98b6397dcc
Author | SHA1 | Date | |
---|---|---|---|
98b6397dcc | |||
715e4559aa | |||
d42c245c9d | |||
ff840299d6 | |||
f69c93ba91 | |||
c0f2430590 |
@@ -1,20 +1,9 @@
|
||||
FROM oven/bun:1.0.25-slim as builder
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
COPY bun.lockb ./
|
||||
COPY dist dist
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Install dependencies
|
||||
RUN bun install
|
||||
|
||||
# Copy source files
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN bun run build
|
||||
|
||||
# Production stage
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
@@ -22,6 +22,7 @@ export const SystemView = () => {
|
||||
}
|
||||
|
||||
const saveSignature = async (signature: Signature): Promise<void> => {
|
||||
console.log(signature);
|
||||
try {
|
||||
// Check if signature already exists
|
||||
let existingRecord: SignatureRecord | null = null;
|
||||
@@ -34,7 +35,7 @@ export const SystemView = () => {
|
||||
const newScannedPercentage = parseScannedPercentage(signature.scanned);
|
||||
|
||||
if (existingRecord) {
|
||||
const updatedSignature: Pick<SignatureRecord, 'updated' | 'type' | 'name' | 'scanned'> = {
|
||||
const updatedSignature: Pick<SignatureRecord, 'updated' | 'type' | 'name' | 'scanned' | 'note'> = {
|
||||
updated: new Date().toISOString()
|
||||
}
|
||||
// Existing record has no type and our new signature has a type
|
||||
@@ -47,6 +48,8 @@ export const SystemView = () => {
|
||||
const existingScannedPercentage = parseScannedPercentage(existingRecord.scanned);
|
||||
if (newScannedPercentage >= existingScannedPercentage)
|
||||
updatedSignature.scanned = signature.scanned;
|
||||
if (!!!existingRecord.note && !!signature.note)
|
||||
updatedSignature.note = signature.note;
|
||||
await pb.collection('signature').update(existingRecord.id, updatedSignature);
|
||||
console.log(`Updated signature ${signature.identifier}: ${existingScannedPercentage}% -> ${newScannedPercentage}%`);
|
||||
} else {
|
||||
@@ -57,7 +60,8 @@ export const SystemView = () => {
|
||||
name: signature.signame,
|
||||
type: signature.type,
|
||||
dangerous: signature.dangerous,
|
||||
scanned: signature.scanned
|
||||
scanned: signature.scanned,
|
||||
note: signature.note
|
||||
});
|
||||
console.log(`Created new signature ${signature.identifier} with ${newScannedPercentage}% scan`);
|
||||
}
|
||||
@@ -70,10 +74,10 @@ export const SystemView = () => {
|
||||
const deleteSignature = async (signatureId: string): Promise<void> => {
|
||||
try {
|
||||
await pb.collection('signature').delete(signatureId);
|
||||
|
||||
|
||||
// Invalidate queries to refresh the data
|
||||
queryClient.invalidateQueries({ queryKey: ['signatures', system] });
|
||||
|
||||
|
||||
toast({
|
||||
title: "Signature Deleted",
|
||||
description: "The signature has been successfully deleted.",
|
||||
@@ -93,14 +97,14 @@ export const SystemView = () => {
|
||||
try {
|
||||
// Get the system ID for the current system
|
||||
const systemId = await getSystemId(system);
|
||||
|
||||
|
||||
console.log('Updating signature:', {
|
||||
identifier: updatedSignature.identifier,
|
||||
systemId,
|
||||
system,
|
||||
updatedSignature
|
||||
});
|
||||
|
||||
|
||||
// Find the signature by identifier and system
|
||||
const existingRecord = await pb.collection('signature').getFirstListItem(
|
||||
`identifier='${updatedSignature.identifier}' && system='${systemId}'`
|
||||
@@ -125,14 +129,17 @@ export const SystemView = () => {
|
||||
if (updatedSignature.scanned !== undefined) {
|
||||
updateData.scanned = updatedSignature.scanned;
|
||||
}
|
||||
if (updatedSignature.note !== undefined) {
|
||||
updateData.note = updatedSignature.note;
|
||||
}
|
||||
|
||||
console.log('Update data:', updateData);
|
||||
|
||||
await pb.collection('signature').update(existingRecord.id, updateData);
|
||||
|
||||
|
||||
// Invalidate queries to refresh the data
|
||||
queryClient.invalidateQueries({ queryKey: ['signatures', system] });
|
||||
|
||||
|
||||
toast({
|
||||
title: "Signature Updated",
|
||||
description: "The signature has been successfully updated.",
|
||||
@@ -199,7 +206,7 @@ export const SystemView = () => {
|
||||
}
|
||||
|
||||
// Turn off clean mode after use
|
||||
setCleanMode(false);
|
||||
// setCleanMode(false);
|
||||
}
|
||||
|
||||
// Save all new/updated signatures
|
||||
|
@@ -1,5 +1,51 @@
|
||||
import { SigviewRecord as Signature } from "@/lib/pbtypes";
|
||||
|
||||
const oneOutOfTen = [
|
||||
"Minmatar Contracted Bio-Farm",
|
||||
"Old Meanie - Cultivation Center",
|
||||
"Pith Robux Asteroid Mining & Co.",
|
||||
"Sansha Military Outpost",
|
||||
"Serpentis Drug Outlet",
|
||||
];
|
||||
const twoOutOfTen = [
|
||||
"Angel Creo-Corp Mining",
|
||||
"Blood Raider Human Farm",
|
||||
"Pith Merchant Depot",
|
||||
"Sansha Acclimatization Facility",
|
||||
"Serpentis Live Cargo Distribution Facilities",
|
||||
"Rogue Drone Infestation Sprout",
|
||||
];
|
||||
const threeOutOfTen = [
|
||||
"Angel Repurposed Outpost",
|
||||
"Blood Raider Intelligence Collection Point",
|
||||
"Guristas Guerilla Grounds",
|
||||
"Sansha's Command Relay Outpost",
|
||||
"Serpentis Narcotic Warehouses",
|
||||
"Rogue Drone Asteroid Infestation",
|
||||
];
|
||||
const fourOutOfTen = [
|
||||
"Angel Cartel Occupied Mining Colony",
|
||||
"Mul-Zatah Monastery",
|
||||
"Guristas Scout Outpost",
|
||||
"Sansha's Nation Occupied Mining Colony",
|
||||
"Serpentis Phi-Outpost",
|
||||
"Drone Infested Mine",
|
||||
];
|
||||
const fiveOutOfTen = [
|
||||
"Angel's Red Light District",
|
||||
"Blood Raider Psychotropics Depot",
|
||||
"Guristas Hallucinogen Supply Waypoint",
|
||||
"Sansha's Nation Neural Paralytic Facility",
|
||||
"Serpentis Corporation Hydroponics Site",
|
||||
"Outgrowth Rogue Drone Hive",
|
||||
];
|
||||
function isFourOutOfTen(signature: string): boolean {
|
||||
return fourOutOfTen.some((s) => signature.includes(s));
|
||||
}
|
||||
function isFiveOutOfTen(signature: string): boolean {
|
||||
return fiveOutOfTen.some((s) => signature.includes(s));
|
||||
}
|
||||
|
||||
export const parseSignature = (text: string): Omit<Signature, 'system' | 'id' | 'sysid'> | null => {
|
||||
const parts = text.split('\t');
|
||||
if (parts.length < 4) return null;
|
||||
@@ -10,12 +56,23 @@ export const parseSignature = (text: string): Omit<Signature, 'system' | 'id' |
|
||||
return null;
|
||||
}
|
||||
|
||||
let note = "";
|
||||
const isFour = isFourOutOfTen(parts[3]);
|
||||
if (isFour) {
|
||||
note = "4/10";
|
||||
}
|
||||
const isFive = isFiveOutOfTen(parts[3]);
|
||||
if (isFive) {
|
||||
note = "5/10";
|
||||
}
|
||||
|
||||
return {
|
||||
identifier: parts[0],
|
||||
type: parts[2],
|
||||
signame: parts[3],
|
||||
scanned: parts.length > 4 ? parts[4] : undefined,
|
||||
dangerous: false // TODO: Implement dangerous signature detection
|
||||
dangerous: false, // TODO: Implement dangerous signature detection
|
||||
note: note,
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user