new: Big Change, Add support for Extensions 😍

This commit is contained in:
hiddify
2024-09-28 20:31:38 +02:00
parent 1f485e1193
commit 3a508b7929
44 changed files with 8946 additions and 619 deletions

View File

@@ -1,6 +1,8 @@
const hiddify = require("./hiddify_grpc_web_pb.js");
const extension = require("./extension_grpc_web_pb.js");
const grpcServerAddress = '/';
const client = new extension.ExtensionHostServicePromiseClient(grpcServerAddress, null, null);
const extensionClient = new extension.ExtensionHostServicePromiseClient(grpcServerAddress, null, null);
const hiddifyClient = new hiddify.CorePromiseClient(grpcServerAddress, null, null);
module.exports = { client ,extension};
module.exports = { extensionClient ,hiddifyClient};

View File

@@ -0,0 +1,109 @@
const { hiddifyClient } = require('./client.js');
const hiddify = require("./hiddify_grpc_web_pb.js");
function openConnectionPage() {
$("#extension-list-container").show();
$("#extension-page-container").hide();
$("#connection-page").show();
connect();
$("#connect-button").click(async () => {
const hsetting_request = new hiddify.ChangeHiddifySettingsRequest();
hsetting_request.setHiddifySettingsJson($("#hiddify-settings").val());
try{
const hres=await hiddifyClient.changeHiddifySettings(hsetting_request, {});
}catch(err){
$("#hiddify-settings").val("")
console.log(err)
}
const parse_request = new hiddify.ParseRequest();
parse_request.setContent($("#config-content").val());
try{
const pres=await hiddifyClient.parse(parse_request, {});
if (pres.getResponseCode() !== hiddify.ResponseCode.OK){
alert(pres.getMessage());
return
}
$("#config-content").val(pres.getContent());
}catch(err){
console.log(err)
alert(JSON.stringify(err))
return
}
const request = new hiddify.StartRequest();
request.setConfigContent($("#config-content").val());
request.setEnableRawConfig(false);
try{
const res=await hiddifyClient.start(request, {});
console.log(res.getCoreState(),res.getMessage())
handleCoreStatus(res.getCoreState());
}catch(err){
console.log(err)
alert(JSON.stringify(err))
return
}
})
$("#disconnect-button").click(async () => {
const request = new hiddify.Empty();
try{
const res=await hiddifyClient.stop(request, {});
console.log(res.getCoreState(),res.getMessage())
handleCoreStatus(res.getCoreState());
}catch(err){
console.log(err)
alert(JSON.stringify(err))
return
}
})
}
function connect(){
const request = new hiddify.Empty();
const stream = hiddifyClient.coreInfoListener(request, {});
stream.on('data', (response) => {
console.log('Receving ',response);
handleCoreStatus(response);
});
stream.on('error', (err) => {
console.error('Error opening extension page:', err);
// openExtensionPage(extensionId);
});
stream.on('end', () => {
console.log('Stream ended');
setTimeout(connect, 1000);
});
}
function handleCoreStatus(status){
if (status == hiddify.CoreState.STOPPED){
$("#connection-before-connect").show();
$("#connection-connecting").hide();
}else{
$("#connection-before-connect").hide();
$("#connection-connecting").show();
if (status == hiddify.CoreState.STARTING){
$("#connection-status").text("Starting");
$("#connection-status").css("color", "yellow");
}else if (status == hiddify.CoreState.STOPPING){
$("#connection-status").text("Stopping");
$("#connection-status").css("color", "red");
}else if (status == hiddify.CoreState.STARTED){
$("#connection-status").text("Connected");
$("#connection-status").css("color", "green");
}
}
}
module.exports = { openConnectionPage };

View File

@@ -1,7 +1,8 @@
const { listExtensions } = require('./extensionList.js');
const { openConnectionPage } = require('./connectionPage.js');
window.onload = () => {
listExtensions();
openConnectionPage();
};

View File

@@ -1,18 +1,16 @@
const { client,extension } = require('./client.js');
const { extensionClient } = require('./client.js');
const extension = require("./extension_grpc_web_pb.js");
async function listExtensions() {
$("#extension-list-container").show();
$("#extension-page-container").hide();
$("#connection-page").show();
try {
const extensionListContainer = document.getElementById('extension-list-container');
const extensionListContainer = document.getElementById('extension-list');
extensionListContainer.innerHTML = ''; // Clear previous entries
const response = await client.listExtensions(new extension.Empty(), {});
const header = document.createElement('h1');
header.classList.add('mb-4');
header.textContent = "Extension List";
extensionListContainer.appendChild(header);
const response = await extensionClient.listExtensions(new extension.Empty(), {});
const extensionList = response.getExtensionsList();
extensionList.forEach(ext => {
const listItem = createExtensionListItem(ext);
@@ -38,14 +36,20 @@ function createExtensionListItem(ext) {
descriptionElement.className = 'mb-0';
descriptionElement.textContent = ext.getDescription();
contentDiv.appendChild(descriptionElement);
contentDiv.style.width="100%";
listItem.appendChild(contentDiv);
const switchDiv = createSwitchElement(ext);
listItem.appendChild(switchDiv);
const {openExtensionPage} = require('./extensionPage.js');
listItem.addEventListener('click', () => openExtensionPage(ext.getId()));
contentDiv.addEventListener('click', () =>{
if (!ext.getEnable() ){
alert("Extension is not enabled")
return
}
openExtensionPage(ext.getId())
});
return listItem;
}
@@ -58,7 +62,10 @@ function createSwitchElement(ext) {
switchButton.type = 'checkbox';
switchButton.className = 'form-check-input';
switchButton.checked = ext.getEnable();
switchButton.addEventListener('change', () => toggleExtension(ext.getId(), switchButton.checked));
switchButton.addEventListener('change', (e) => {
toggleExtension(ext.getId(), switchButton.checked)
});
switchDiv.appendChild(switchButton);
return switchDiv;
@@ -70,11 +77,12 @@ async function toggleExtension(extensionId, enable) {
request.setEnable(enable);
try {
await client.editExtension(request, {});
await extensionClient.editExtension(request, {});
console.log(`Extension ${extensionId} updated to ${enable ? 'enabled' : 'disabled'}`);
} catch (err) {
console.error('Error updating extension status:', err);
}
listExtensions();
}

View File

@@ -1,18 +1,25 @@
const { client,extension } = require('./client.js');
const { extensionClient } = require('./client.js');
const extension = require("./extension_grpc_web_pb.js");
const { renderForm } = require('./formRenderer.js');
const { listExtensions } = require('./extensionList.js');
var currentExtensionId=undefined;
function openExtensionPage(extensionId) {
currentExtensionId=extensionId;
$("#extension-list-container").hide();
$("#extension-page-container").show();
const request = new extension.ExtensionRequest();
request.setExtensionId(extensionId);
$("#extension-page-container").show();
$("#connection-page").hide();
connect()
}
const stream = client.connect(request, {});
function connect() {
const request = new extension.ExtensionRequest();
request.setExtensionId(currentExtensionId);
const stream = extensionClient.connect(request, {});
stream.on('data', (response) => {
console.log('Receving ',response);
if (response.getExtensionId() === currentExtensionId) {
ui=JSON.parse(response.getJsonUi())
if(response.getType()== proto.hiddifyrpc.ExtensionResponseType.SHOW_DIALOG) {
@@ -27,25 +34,29 @@ function openExtensionPage(extensionId) {
stream.on('error', (err) => {
console.error('Error opening extension page:', err);
// openExtensionPage(extensionId);
});
stream.on('end', () => {
console.log('Stream ended');
setTimeout(connect, 1000);
});
}
async function handleSubmitButtonClick(event) {
event.preventDefault();
bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide();
const formData = new FormData(event.target.closest('form'));
const request = new extension.ExtensionRequest();
const datamap=request.getDataMap()
formData.forEach((value, key) => {
request.getDataMap()[key] = value;
datamap.set(key,value);
});
request.setExtensionId(currentExtensionId);
try {
await client.submitForm(request, {});
await extensionClient.submitForm(request, {});
console.log('Form submitted successfully.');
} catch (err) {
console.error('Error submitting form:', err);
@@ -58,7 +69,9 @@ async function handleCancelButtonClick(event) {
request.setExtensionId(currentExtensionId);
try {
await client.cancel(request, {});
bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide();
await extensionClient.cancel(request, {});
console.log('Extension cancelled successfully.');
} catch (err) {
console.error('Error cancelling extension:', err);
@@ -71,7 +84,7 @@ async function handleStopButtonClick(event) {
request.setExtensionId(currentExtensionId);
try {
await client.stop(request, {});
await extensionClient.stop(request, {});
console.log('Extension stopped successfully.');
currentExtensionId = undefined;
listExtensions(); // Return to the extension list

View File

@@ -1,5 +1,9 @@
const { client } = require('./client.js');
const extension = require("./extension_grpc_web_pb.js");
const ansi_up = new AnsiUp({
escape_html: false,
});
function renderForm(json, dialog, submitAction, cancelAction, stopAction) {
const container = document.getElementById(`extension-page-container${dialog}`);
@@ -10,23 +14,36 @@ function renderForm(json, dialog, submitAction, cancelAction, stopAction) {
existingForm.remove();
}
const form = document.createElement('form');
container.appendChild(form);
form.id = formId;
if (dialog === "dialog") {
document.getElementById("modalLabel").textContent = json.title;
} else {
const titleElement = createTitleElement(json);
if (stopAction != undefined) {
const stopButton = document.createElement('button');
stopButton.textContent = "Back";
stopButton.classList.add('btn', 'btn-danger');
stopButton.addEventListener('click', stopAction);
form.appendChild(stopButton);
}
form.appendChild(titleElement);
}
addElementsToForm(form, json);
const buttonGroup = createButtonGroup(json, submitAction, cancelAction, stopAction);
const buttonGroup = createButtonGroup(json, submitAction, cancelAction);
if (dialog === "dialog") {
document.getElementById("modal-footer").innerHTML = '';
document.getElementById("modal-footer").appendChild(buttonGroup);
const dialog = bootstrap.Modal.getOrCreateInstance("#extension-dialog");
dialog.show()
dialog.on("hidden.bs.modal", () => {
cancelAction()
})
} else {
form.appendChild(buttonGroup);
}
container.appendChild(form);
}
function addElementsToForm(form, json) {
@@ -36,12 +53,12 @@ function addElementsToForm(form, json) {
const description = document.createElement('p');
description.textContent = json.description;
form.appendChild(description);
json.fields.forEach(field => {
const formGroup = createFormGroup(field);
form.appendChild(formGroup);
});
if (json.fields) {
json.fields.forEach(field => {
const formGroup = createFormGroup(field);
form.appendChild(formGroup);
});
}
return form;
}
@@ -72,6 +89,11 @@ function createInputElement(field) {
let input;
switch (field.type) {
case "Console":
input = document.createElement('pre');
input.innerHTML = ansi_up.ansi_to_html(field.value || field.placeholder || '');
input.style.maxHeight = field.lines * 20 + 'px';
break;
case "TextArea":
input = document.createElement('textarea');
input.rows = field.lines || 3;
@@ -167,30 +189,25 @@ function createSwitchElement(field) {
return switchWrapper;
}
function createButtonGroup(json, submitAction, cancelAction, stopAction) {
function createButtonGroup(json, submitAction, cancelAction) {
const buttonGroup = document.createElement('div');
buttonGroup.classList.add('btn-group');
json.buttons.forEach(buttonText => {
const btn = document.createElement('button');
btn.classList.add('btn',"btn-default");
buttonGroup.appendChild(btn);
btn.textContent = buttonText
if (buttonText=="Cancel") {
btn.classList.add( 'btn-secondary');
btn.addEventListener('click', cancelAction);
}else{
if (buttonText=="Submit"||buttonText=="Ok")
btn.classList.add('btn-primary');
btn.addEventListener('click', submitAction);
}
})
const cancelButton = document.createElement('button');
cancelButton.textContent = "Cancel";
cancelButton.classList.add('btn', 'btn-secondary');
cancelButton.addEventListener('click', cancelAction);
buttonGroup.appendChild(cancelButton);
if (stopAction != undefined) {
const stopButton = document.createElement('button');
stopButton.textContent = "Stop";
stopButton.classList.add('btn', 'btn-danger');
stopButton.addEventListener('click', stopAction);
buttonGroup.appendChild(stopButton);
}
if (json.buttonMode === "SubmitCancel") {
const submitButton = document.createElement('button');
submitButton.textContent = "Submit";
submitButton.classList.add('btn', 'btn-primary');
submitButton.addEventListener('click', submitAction);
buttonGroup.appendChild(submitButton);
}
return buttonGroup;

View File

@@ -250,6 +250,230 @@ proto.hiddifyrpc.CorePromiseClient.prototype.start =
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.hiddifyrpc.Empty,
* !proto.hiddifyrpc.CoreInfoResponse>}
*/
const methodDescriptor_Core_CoreInfoListener = new grpc.web.MethodDescriptor(
'/hiddifyrpc.Core/CoreInfoListener',
grpc.web.MethodType.SERVER_STREAMING,
base_pb.Empty,
proto.hiddifyrpc.CoreInfoResponse,
/**
* @param {!proto.hiddifyrpc.Empty} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
);
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.CoreInfoResponse>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CoreClient.prototype.coreInfoListener =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/CoreInfoListener',
request,
metadata || {},
methodDescriptor_Core_CoreInfoListener);
};
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.CoreInfoResponse>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CorePromiseClient.prototype.coreInfoListener =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/CoreInfoListener',
request,
metadata || {},
methodDescriptor_Core_CoreInfoListener);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.hiddifyrpc.Empty,
* !proto.hiddifyrpc.OutboundGroupList>}
*/
const methodDescriptor_Core_OutboundsInfo = new grpc.web.MethodDescriptor(
'/hiddifyrpc.Core/OutboundsInfo',
grpc.web.MethodType.SERVER_STREAMING,
base_pb.Empty,
proto.hiddifyrpc.OutboundGroupList,
/**
* @param {!proto.hiddifyrpc.Empty} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.hiddifyrpc.OutboundGroupList.deserializeBinary
);
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.OutboundGroupList>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CoreClient.prototype.outboundsInfo =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/OutboundsInfo',
request,
metadata || {},
methodDescriptor_Core_OutboundsInfo);
};
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.OutboundGroupList>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CorePromiseClient.prototype.outboundsInfo =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/OutboundsInfo',
request,
metadata || {},
methodDescriptor_Core_OutboundsInfo);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.hiddifyrpc.Empty,
* !proto.hiddifyrpc.OutboundGroupList>}
*/
const methodDescriptor_Core_MainOutboundsInfo = new grpc.web.MethodDescriptor(
'/hiddifyrpc.Core/MainOutboundsInfo',
grpc.web.MethodType.SERVER_STREAMING,
base_pb.Empty,
proto.hiddifyrpc.OutboundGroupList,
/**
* @param {!proto.hiddifyrpc.Empty} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.hiddifyrpc.OutboundGroupList.deserializeBinary
);
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.OutboundGroupList>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CoreClient.prototype.mainOutboundsInfo =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/MainOutboundsInfo',
request,
metadata || {},
methodDescriptor_Core_MainOutboundsInfo);
};
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.OutboundGroupList>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CorePromiseClient.prototype.mainOutboundsInfo =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/MainOutboundsInfo',
request,
metadata || {},
methodDescriptor_Core_MainOutboundsInfo);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.hiddifyrpc.Empty,
* !proto.hiddifyrpc.SystemInfo>}
*/
const methodDescriptor_Core_GetSystemInfo = new grpc.web.MethodDescriptor(
'/hiddifyrpc.Core/GetSystemInfo',
grpc.web.MethodType.SERVER_STREAMING,
base_pb.Empty,
proto.hiddifyrpc.SystemInfo,
/**
* @param {!proto.hiddifyrpc.Empty} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.hiddifyrpc.SystemInfo.deserializeBinary
);
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.SystemInfo>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CoreClient.prototype.getSystemInfo =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/GetSystemInfo',
request,
metadata || {},
methodDescriptor_Core_GetSystemInfo);
};
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.SystemInfo>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CorePromiseClient.prototype.getSystemInfo =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/GetSystemInfo',
request,
metadata || {},
methodDescriptor_Core_GetSystemInfo);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
@@ -375,16 +599,16 @@ proto.hiddifyrpc.CorePromiseClient.prototype.parse =
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.hiddifyrpc.ChangeConfigOptionsRequest,
* !proto.hiddifyrpc.ChangeHiddifySettingsRequest,
* !proto.hiddifyrpc.CoreInfoResponse>}
*/
const methodDescriptor_Core_ChangeConfigOptions = new grpc.web.MethodDescriptor(
'/hiddifyrpc.Core/ChangeConfigOptions',
const methodDescriptor_Core_ChangeHiddifySettings = new grpc.web.MethodDescriptor(
'/hiddifyrpc.Core/ChangeHiddifySettings',
grpc.web.MethodType.UNARY,
proto.hiddifyrpc.ChangeConfigOptionsRequest,
proto.hiddifyrpc.ChangeHiddifySettingsRequest,
proto.hiddifyrpc.CoreInfoResponse,
/**
* @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} request
* @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request
* @return {!Uint8Array}
*/
function(request) {
@@ -395,7 +619,7 @@ const methodDescriptor_Core_ChangeConfigOptions = new grpc.web.MethodDescriptor(
/**
* @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} request The
* @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
@@ -404,32 +628,32 @@ const methodDescriptor_Core_ChangeConfigOptions = new grpc.web.MethodDescriptor(
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.CoreInfoResponse>|undefined}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CoreClient.prototype.changeConfigOptions =
proto.hiddifyrpc.CoreClient.prototype.changeHiddifySettings =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/hiddifyrpc.Core/ChangeConfigOptions',
'/hiddifyrpc.Core/ChangeHiddifySettings',
request,
metadata || {},
methodDescriptor_Core_ChangeConfigOptions,
methodDescriptor_Core_ChangeHiddifySettings,
callback);
};
/**
* @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} request The
* @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The
* request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!Promise<!proto.hiddifyrpc.CoreInfoResponse>}
* Promise that resolves to the response
*/
proto.hiddifyrpc.CorePromiseClient.prototype.changeConfigOptions =
proto.hiddifyrpc.CorePromiseClient.prototype.changeHiddifySettings =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/hiddifyrpc.Core/ChangeConfigOptions',
'/hiddifyrpc.Core/ChangeHiddifySettings',
request,
metadata || {},
methodDescriptor_Core_ChangeConfigOptions);
methodDescriptor_Core_ChangeHiddifySettings);
};
@@ -921,6 +1145,62 @@ proto.hiddifyrpc.CorePromiseClient.prototype.setSystemProxyEnabled =
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.hiddifyrpc.Empty,
* !proto.hiddifyrpc.LogMessage>}
*/
const methodDescriptor_Core_LogListener = new grpc.web.MethodDescriptor(
'/hiddifyrpc.Core/LogListener',
grpc.web.MethodType.SERVER_STREAMING,
base_pb.Empty,
proto.hiddifyrpc.LogMessage,
/**
* @param {!proto.hiddifyrpc.Empty} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.hiddifyrpc.LogMessage.deserializeBinary
);
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.LogMessage>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CoreClient.prototype.logListener =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/LogListener',
request,
metadata || {},
methodDescriptor_Core_LogListener);
};
/**
* @param {!proto.hiddifyrpc.Empty} request The request proto
* @param {?Object<string, string>=} metadata User defined
* call metadata
* @return {!grpc.web.ClientReadableStream<!proto.hiddifyrpc.LogMessage>}
* The XHR Node Readable Stream
*/
proto.hiddifyrpc.CorePromiseClient.prototype.logListener =
function(request, metadata) {
return this.client_.serverStreaming(this.hostname_ +
'/hiddifyrpc.Core/LogListener',
request,
metadata || {},
methodDescriptor_Core_LogListener);
};
/**
* @param {string} hostname
* @param {?Object} credentials

View File

@@ -23,7 +23,7 @@ var global =
var base_pb = require('./base_pb.js');
goog.object.extend(proto, base_pb);
goog.exportSymbol('proto.hiddifyrpc.ChangeConfigOptionsRequest', null, global);
goog.exportSymbol('proto.hiddifyrpc.ChangeHiddifySettingsRequest', null, global);
goog.exportSymbol('proto.hiddifyrpc.CoreInfoResponse', null, global);
goog.exportSymbol('proto.hiddifyrpc.CoreState', null, global);
goog.exportSymbol('proto.hiddifyrpc.GenerateConfigRequest', null, global);
@@ -356,16 +356,16 @@ if (goog.DEBUG && !COMPILED) {
* @extends {jspb.Message}
* @constructor
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest = function(opt_data) {
proto.hiddifyrpc.ChangeHiddifySettingsRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.hiddifyrpc.ChangeConfigOptionsRequest, jspb.Message);
goog.inherits(proto.hiddifyrpc.ChangeHiddifySettingsRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest.displayName = 'proto.hiddifyrpc.ChangeConfigOptionsRequest';
proto.hiddifyrpc.ChangeHiddifySettingsRequest.displayName = 'proto.hiddifyrpc.ChangeHiddifySettingsRequest';
}
/**
* Generated by JsPbCodeGenerator.
@@ -3625,8 +3625,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.toObject = function(opt_includeInstance) {
return proto.hiddifyrpc.ChangeConfigOptionsRequest.toObject(opt_includeInstance, this);
proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.toObject = function(opt_includeInstance) {
return proto.hiddifyrpc.ChangeHiddifySettingsRequest.toObject(opt_includeInstance, this);
};
@@ -3635,13 +3635,13 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.toObject = function(opt_in
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} msg The msg instance to transform.
* @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest.toObject = function(includeInstance, msg) {
proto.hiddifyrpc.ChangeHiddifySettingsRequest.toObject = function(includeInstance, msg) {
var f, obj = {
configOptionsJson: jspb.Message.getFieldWithDefault(msg, 1, "")
hiddifySettingsJson: jspb.Message.getFieldWithDefault(msg, 1, "")
};
if (includeInstance) {
@@ -3655,23 +3655,23 @@ configOptionsJson: jspb.Message.getFieldWithDefault(msg, 1, "")
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.hiddifyrpc.ChangeConfigOptionsRequest}
* @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest}
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinary = function(bytes) {
proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.hiddifyrpc.ChangeConfigOptionsRequest;
return proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinaryFromReader(msg, reader);
var msg = new proto.hiddifyrpc.ChangeHiddifySettingsRequest;
return proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} msg The message object to deserialize into.
* @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.hiddifyrpc.ChangeConfigOptionsRequest}
* @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest}
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinaryFromReader = function(msg, reader) {
proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@@ -3680,7 +3680,7 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinaryFromReader = functi
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setConfigOptionsJson(value);
msg.setHiddifySettingsJson(value);
break;
default:
reader.skipField();
@@ -3695,9 +3695,9 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.deserializeBinaryFromReader = functi
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.serializeBinary = function() {
proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.hiddifyrpc.ChangeConfigOptionsRequest.serializeBinaryToWriter(this, writer);
proto.hiddifyrpc.ChangeHiddifySettingsRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
@@ -3705,13 +3705,13 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.serializeBinary = function
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.hiddifyrpc.ChangeConfigOptionsRequest} message
* @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest.serializeBinaryToWriter = function(message, writer) {
proto.hiddifyrpc.ChangeHiddifySettingsRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getConfigOptionsJson();
f = message.getHiddifySettingsJson();
if (f.length > 0) {
writer.writeString(
1,
@@ -3722,19 +3722,19 @@ proto.hiddifyrpc.ChangeConfigOptionsRequest.serializeBinaryToWriter = function(m
/**
* optional string config_options_json = 1;
* optional string hiddify_settings_json = 1;
* @return {string}
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.getConfigOptionsJson = function() {
proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.getHiddifySettingsJson = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.hiddifyrpc.ChangeConfigOptionsRequest} returns this
* @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} returns this
*/
proto.hiddifyrpc.ChangeConfigOptionsRequest.prototype.setConfigOptionsJson = function(value) {
proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.setHiddifySettingsJson = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};