diag: add example.com connectivity probe (PROBE_RESULT) to determine if Figma sandbox has internet egress; bump 0.1.11
This commit is contained in:
1 parent
7307fa6c76
commit
0f7005e4b1
5 files changed
+20
-4
No files matched your search
+2
-1
@@ -9,7 +9,8 @@ const manifest = JSON.parse(fs.readFileSync(file, 'utf8'))
|
|||||||
manifest.networkAccess = {
|
manifest.networkAccess = {
|
||||||
allowedDomains: [
|
allowedDomains: [
|
||||||
'https://api.apinex.bond',
|
'https://api.apinex.bond',
|
||||||
'https://apinex.bond'
|
'https://apinex.bond',
|
||||||
|
'https://example.com'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -16,7 +16,8 @@
|
|||||||
"networkAccess": {
|
"networkAccess": {
|
||||||
"allowedDomains": [
|
"allowedDomains": [
|
||||||
"https://api.apinex.bond",
|
"https://api.apinex.bond",
|
||||||
"https://apinex.bond"
|
"https://apinex.bond",
|
||||||
|
"https://example.com"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "figma-ai-plugin",
|
"name": "figma-ai-plugin",
|
||||||
"version": "0.1.10",
|
"version": "0.1.11",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@create-figma-plugin/ui": "^4.0.3",
|
"@create-figma-plugin/ui": "^4.0.3",
|
||||||
|
|||||||
@@ -511,6 +511,13 @@ export default function () {
|
|||||||
emit('MODELS_RESULT', { ok: false, error: 'fetch is not available in the plugin main thread', models: [], status: 0, requestEcho: echo })
|
emit('MODELS_RESULT', { ok: false, error: 'fetch is not available in the plugin main thread', models: [], status: 0, requestEcho: echo })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// diagnostic: can the sandbox reach the public internet at all?
|
||||||
|
try {
|
||||||
|
const pr = await fetch('https://example.com')
|
||||||
|
emit('PROBE_RESULT', { msg: 'example.com reachable · status=' + pr.status })
|
||||||
|
} catch (pe) {
|
||||||
|
emit('PROBE_RESULT', { msg: 'example.com UNREACHABLE · ' + (pe != null ? (typeof pe === 'string' ? pe : JSON.stringify(pe)) : 'unknown') })
|
||||||
|
}
|
||||||
const base = payload.baseUrl.replace(/\/+$/, '')
|
const base = payload.baseUrl.replace(/\/+$/, '')
|
||||||
const res = await fetch(base + '/models', {
|
const res = await fetch(base + '/models', {
|
||||||
headers: { Authorization: 'Bearer ' + payload.apiKey }
|
headers: { Authorization: 'Bearer ' + payload.apiKey }
|
||||||
|
|||||||
+8
-1
@@ -29,7 +29,7 @@ const MIN_WINDOW_SIZE = { width: 320, height: 200 }
|
|||||||
// very high — actual clamp is done by main via clampWindowSize (bounds*zoom).
|
// very high — actual clamp is done by main via clampWindowSize (bounds*zoom).
|
||||||
|
|
||||||
// Full plugin version shown in the footer status bar. Keep in sync with package.json "version".
|
// Full plugin version shown in the footer status bar. Keep in sync with package.json "version".
|
||||||
const PLUGIN_VERSION = '0.1.10'
|
const PLUGIN_VERSION = '0.1.11'
|
||||||
|
|
||||||
const fieldStyle = {
|
const fieldStyle = {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -135,6 +135,13 @@ function SettingsPanel (props: { settings: Settings, setSettings: (s: Settings)
|
|||||||
return dispose
|
return dispose
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
useEffect(function () {
|
||||||
|
const dispose = on('PROBE_RESULT', function (p: { msg: string }) {
|
||||||
|
logEvent('PROBE: ' + p.msg)
|
||||||
|
})
|
||||||
|
return dispose
|
||||||
|
}, [])
|
||||||
|
|
||||||
function patch (p: Partial<ProviderConfig>) {
|
function patch (p: Partial<ProviderConfig>) {
|
||||||
if (provider == null) return
|
if (provider == null) return
|
||||||
setSettings({
|
setSettings({
|
||||||
|
|||||||
Reference in new issue
Block a user