123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- clog(".")
-
-
-
-
-
- window.vcb_fn = window.vcb_fn || {}
-
- // vcb_fn = {
- Object.assign(vcb_fn,{
- default_api_err(data,status,xhr){
- clog("default_api_err",{that:this,data,status,xhr,args:[...arguments]})
- },
- log_api_success(data,status,xhr){
- clog("log_api_success",{that:this,data,status,xhr,args:[...arguments]})
- },
-
- })
-
-
-
-
-
-
- // C:\bspace\repos\jc4\ign4\libs\mustache.js
-
-
-
-
- base_vapi_request = {
- // url: "https://api.digitalocean.com/v2/droplets",
- // data: file.qs,
- // cache:false,
- // "passme":"abc124",
- success: vcb_fn.log_api_success,
- error: vcb_fn.default_api_err,
- headers:{
- "Content-Type": "application/json",
- "Authorization": `Bearer ${localStorage.TOKEN}`,
- }
- }
-
-
-
-
- function get_name(id){
- var k,v
- for ([k,v] of Object.entries(vproc.droplets)){
- // clog(k,v)
- if (v.id==id){
- return v.name
- }
- }
- }
-
-
- function get_id(name){
- var k,v
- for ([k,v] of Object.entries(vproc.droplets)){
- // clog(k,v)
- if (v.name==name){
- return v.id
- }
- }
- }
-
-
- function fillTemplate5(a){
- return a
- r = Mustache.render(t,o)
- }
-
- function vapi_req(obj,tv={}){
- /*
- if (!tflag){
- clog("NO tflag")
- return
- }
- */
- // console.trace("vapi_req")
- var ajx_arg = Object.assign({},base_vapi_request,obj)
- // clog("URL0",JSON.stringify(ajx_arg),ajx_arg)
-
- ajx_arg.url = fillTemplate5(ajx_arg.url,tv)
- if (!ajx_arg.url.startsWith("https://api.digitalocean.com")){
- console.error("WRONG SITE",ajx_arg.url)
- // return
- }
- // if (is_token_set()){ return token_not_set()}
- clog("vapi_req_0",ajx_arg)
- // clog("vapi_req_1",jc(ajx_arg))
- // clog("URL1",JSON.stringify(ajx_arg),ajx_arg)
-
-
- var aii = $.ajax(ajx_arg)
- clog(aii)
- window.aii = aii
-
- }
-
- // s-1vcpu-1gb-amd
- // vapi_req({url:`https://api.digitalocean.com/v2/sizes?per_page=200`})
- // vapi_req({url:`https://api.digitalocean.com/v2/droplets?per_page=200`})
- // vapi_req({url:`https://api.digitalocean.com/v2/domains?per_page=200`})
-
|