Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add virustotal results to version screen #192

Merged
9 changes: 9 additions & 0 deletions src/gql/mods/versions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ query GetModVersions($mod: ModID!, $limit: Int!, $offset: Int!) {
hash
size
}
virustotal_results {
created_at
file_name
hash
id
safe
updated_at
version_id
}
}
}
}
9 changes: 9 additions & 0 deletions src/gql/versions/mod_version.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,14 @@ query GetModVersion($version: VersionID!) {
optional
condition
}
virustotal_results {
created_at
file_name
hash
id
safe
updated_at
version_id
}
}
}
52 changes: 52 additions & 0 deletions src/lib/components/versions/VirustotalResults.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<script lang="ts">
import type { VirustotalResult } from '$lib/generated';
import { getTranslate } from '@tolgee/svelte';

export let results!: Array<VirustotalResult>;
export const { t } = getTranslate();
</script>

<div class="grid grid-flow-row">
<h3 class="my-4 text-2xl font-bold">VirusTotal Results</h3>
<table aria-label="Required Mod Dependencies" class="max-w-auto table table-hover !overflow-visible">
knightzac19 marked this conversation as resolved.
Show resolved Hide resolved
<thead>
<tr class="rounded border !border-surface-500">
<td style="width: 20%;"><div class="text-center" title="File Name">File Name</div></td>
<td style="width: 20%;"><div class="text-center" title="Results">Results</div></td>
<td style="width: 20%;"><div class="text-center" title="Safe">Safe</div></td>
</tr>
</thead>
<tbody>
{#each results as result}
<tr class="rounded border !border-surface-500">
<td>
<div class="text-center">{result.file_name}</div>
</td>
<td>
<div class="text-center">
<a
title="View VirusTotal Result"
href={`https://www.virustotal.com/gui/file/${result.hash}`}
target="_blank"
class="text-white">
<span class="material-icons text-center" style="width: 20px" title={$t('version.virustotal.result')}>
policy
</span>
</a>
</div>
</td>
<td
><div class="text-center">
<span
class="material-icons text-center"
style="width: 20px"
title={result.safe ? $t('version.virustotal.safe') : $t('version.virustotal.not_safe')}>
{result.safe ? 'checkmark' : 'cancel'}
</span>
</div>
</td>
</tr>
{/each}
</tbody>
</table>
</div>
2 changes: 2 additions & 0 deletions src/routes/mod/[modId]/version/[versionId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { getModalStore, getToastStore, type ModalSettings, popup } from '@skeletonlabs/skeleton';
import Page404 from '$lib/components/general/Page404.svelte';
import { getTranslate } from '@tolgee/svelte';
import VirustotalResults from '$lib/components/versions/VirustotalResults.svelte';

export const { t } = getTranslate();

Expand Down Expand Up @@ -164,6 +165,7 @@
<VersionInfo version={$version.data.getVersion} />
<VersionTargetSupportGrid targets={$version.data.getVersion.targets} />
<VersionDependenciesGrid dependencies={$version.data.getVersion.dependencies} />
<VirustotalResults results={$version.data.getVersion.virustotal_results} />
</div>
</div>
</div>
Expand Down