Skip to content

Commit

Permalink
v0.0.3
Browse files Browse the repository at this point in the history
consts to vars etc fixes
  • Loading branch information
ytisf committed Aug 24, 2024
1 parent ce8314a commit 886ebee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,11 @@ class EnrichIndicator {
const activeLeaf = this.app.workspace.activeLeaf;

if (activeLeaf) {
const editor = activeLeaf.view.sourceMode.cmEditor;
// const editor = activeLeaf.view.sourceMode.cmEditor;
const noteTitle = this.app.workspace.getActiveFile().basename;

var search_type = identifyInput(noteTitle);
var url_to_get = `https://www.virustotal.com/api/v3/${search_type}/${noteTitle}`;
const search_type = identifyInput(noteTitle);
const url_to_get = `https://www.virustotal.com/api/v3/${search_type}/${noteTitle}`;

// Use the curlRequest function to send data to an API
httpFunction({
Expand All @@ -400,7 +400,7 @@ class EnrichIndicator {
try {
// Attempt to parse the content string into JSON
var fixed_content = convertEpochToISO(JSON.parse(response.content)["data"]);
var data = JSON.stringify(fixed_content, null, 2);
let data = JSON.stringify(fixed_content, null, 2);
} catch (error) {
console.error('Error parsing JSON from content:', error);
var data = '{"error": "Failed to parse content"}';
Expand All @@ -415,13 +415,13 @@ class EnrichIndicator {
}

// Got Response - Now process it:
var bottom_appendix = '\n\n\n\n\n#### Appendix - VirusTotal Output\n```json\n' + data + '\n```\n\n';
const bottom_appendix = '\n\n\n\n\n#### Appendix - VirusTotal Output\n```json\n' + data + '\n```\n\n';

// Ensure the cursor is at the bottom and append the data
editor.setCursor(editor.lineCount(), 0);
editor.replaceSelection(bottom_appendix);

const file = this.app.workspace.getActiveFile();
const file = editor.file;
this.app.fileManager.processFrontMatter(file, (frontmatter) => {
const now = new Date().toISOString().replace('T', ' ').substring(0, 19);

Expand Down
14 changes: 7 additions & 7 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class AboutModal extends Modal {

contentEl.createEl('img', {
attr: {
src: 'path_to_your_image.png',
src: 'Logo.png',
alt: 'Plugin Icon'
},
cls: 'modal-icon'
Expand Down Expand Up @@ -380,11 +380,11 @@ class EnrichIndicator {
const activeLeaf = this.app.workspace.activeLeaf;

if (activeLeaf) {
const editor = activeLeaf.view.sourceMode.cmEditor;
// const editor = activeLeaf.view.sourceMode.cmEditor;
const noteTitle = this.app.workspace.getActiveFile().basename;

var search_type = identifyInput(noteTitle);
var url_to_get = `https://www.virustotal.com/api/v3/${search_type}/${noteTitle}`;
const search_type = identifyInput(noteTitle);
const url_to_get = `https://www.virustotal.com/api/v3/${search_type}/${noteTitle}`;

// Use the curlRequest function to send data to an API
httpFunction({
Expand All @@ -400,7 +400,7 @@ class EnrichIndicator {
try {
// Attempt to parse the content string into JSON
var fixed_content = convertEpochToISO(JSON.parse(response.content)["data"]);
var data = JSON.stringify(fixed_content, null, 2);
let data = JSON.stringify(fixed_content, null, 2);
} catch (error) {
console.error('Error parsing JSON from content:', error);
var data = '{"error": "Failed to parse content"}';
Expand All @@ -415,13 +415,13 @@ class EnrichIndicator {
}

// Got Response - Now process it:
var bottom_appendix = '\n\n\n\n\n#### Appendix - VirusTotal Output\n```json\n' + data + '\n```\n\n';
const bottom_appendix = '\n\n\n\n\n#### Appendix - VirusTotal Output\n```json\n' + data + '\n```\n\n';

// Ensure the cursor is at the bottom and append the data
editor.setCursor(editor.lineCount(), 0);
editor.replaceSelection(bottom_appendix);

const file = this.app.workspace.getActiveFile();
const file = editor.file;
this.app.fileManager.processFrontMatter(file, (frontmatter) => {
const now = new Date().toISOString().replace('T', ' ').substring(0, 19);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,11 @@ class EnrichIndicator {
const activeLeaf = this.app.workspace.activeLeaf;

if (activeLeaf) {
const editor = activeLeaf.view.sourceMode.cmEditor;
// const editor = activeLeaf.view.sourceMode.cmEditor;
const noteTitle = this.app.workspace.getActiveFile().basename;

var search_type = identifyInput(noteTitle);
var url_to_get = `https://www.virustotal.com/api/v3/${search_type}/${noteTitle}`;
const search_type = identifyInput(noteTitle);
const url_to_get = `https://www.virustotal.com/api/v3/${search_type}/${noteTitle}`;

// Use the curlRequest function to send data to an API
httpFunction({
Expand All @@ -400,7 +400,7 @@ class EnrichIndicator {
try {
// Attempt to parse the content string into JSON
var fixed_content = convertEpochToISO(JSON.parse(response.content)["data"]);
var data = JSON.stringify(fixed_content, null, 2);
let data = JSON.stringify(fixed_content, null, 2);
} catch (error) {
console.error('Error parsing JSON from content:', error);
var data = '{"error": "Failed to parse content"}';
Expand All @@ -415,13 +415,13 @@ class EnrichIndicator {
}

// Got Response - Now process it:
var bottom_appendix = '\n\n\n\n\n#### Appendix - VirusTotal Output\n```json\n' + data + '\n```\n\n';
const bottom_appendix = '\n\n\n\n\n#### Appendix - VirusTotal Output\n```json\n' + data + '\n```\n\n';

// Ensure the cursor is at the bottom and append the data
editor.setCursor(editor.lineCount(), 0);
editor.replaceSelection(bottom_appendix);

const file = this.app.workspace.getActiveFile();
const file = editor.file;
this.app.fileManager.processFrontMatter(file, (frontmatter) => {
const now = new Date().toISOString().replace('T', ' ').substring(0, 19);

Expand Down

0 comments on commit 886ebee

Please sign in to comment.