<commit_before>// pluginapi.js: Sia-UI plugin API interface exposed to all plugins.
// This is injected into every plugin's global namespace.
import Siad from 'sia.js'
import { remote } from 'electron'
const dialog = remote.dialog
const mainWindow = remote.getCurrentWindow()
const config = remote.getGlobal('config')
Siad.configure(config.siad)

window.SiaAPI = {
	call: Siad.call,
	config: config,
	hastingsToSiacoins: Siad.hastingsToSiacoins,<commit_msg>add siad plugin disabling on stop<commit_after>// pluginapi.js: Sia-UI plugin API interface exposed to all plugins.
// This is injected into every plugin's global namespace.
import Siad from 'sia.js'
import { remote } from 'electron'
import Path from 'path'
const dialog = remote.dialog
const app = remote.app
const mainWindow = remote.getCurrentWindow()
const config = remote.getGlobal('config')
Siad.configure(config.siad)
let disabled = false

// Poll Siad.ifRunning and disable the plugin if siad is not running.
setInterval(() => {
	Siad.ifRunning(() => {
		if (disabled) {
			window.location.reload()
		}
	}, () => {
		if (!disabled) {
			disabled = true
			document.body.innerHTML = "<h1>Siad has stopped.</h1>"
		}
	})
}, 2000)

// Siad call wrapper.
// Only call siad if siad is running.
const callWrapper = (uri, callback) => {
	Siad.ifRunning(() => {
		Siad.call(uri, callback)
	})
}

window.SiaAPI = {
	call: callWrapper,
	config: config,
	hastingsToSiacoins: Siad.hastingsToSiacoins,
{'fraction_non_alphanumeric': 0.1231933929800413, 'fraction_numerical': 0.0041293874741913286, 'mean_word_length': 4.326007326007326, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5771605', 'n_tokens_mistral': 490, 'n_tokens_neox': 469, 'n_words': 142}