update /api/method/ to /api/action/
This commit is contained in:
parent
2e1e6d961b
commit
5dcd9bc52d
@ -113,7 +113,7 @@ function payUnpaidInvoices() {
|
|||||||
let invoice = _unpaidInvoices;
|
let invoice = _unpaidInvoices;
|
||||||
if (invoice.stripe_invoice_url && team.pg.payment_mode === 'Card') {
|
if (invoice.stripe_invoice_url && team.pg.payment_mode === 'Card') {
|
||||||
window.open(
|
window.open(
|
||||||
`/api/method/jcloude.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`,
|
`/api/action/jcloude.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showAddPrepaidCreditsDialog.value = true;
|
showAddPrepaidCreditsDialog.value = true;
|
||||||
|
|||||||
@ -350,7 +350,7 @@ function payUnpaidInvoices() {
|
|||||||
let invoice = _unpaidInvoices[0];
|
let invoice = _unpaidInvoices[0];
|
||||||
if (invoice.stripe_invoice_url && team.pg.payment_mode === 'Card') {
|
if (invoice.stripe_invoice_url && team.pg.payment_mode === 'Card') {
|
||||||
window.open(
|
window.open(
|
||||||
`/api/method/jcloude.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`,
|
`/api/action/jcloude.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showAddPrepaidCreditsDialog.value = true;
|
showAddPrepaidCreditsDialog.value = true;
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
v-model="paymentGatewayDetails.url"
|
v-model="paymentGatewayDetails.url"
|
||||||
name="url"
|
name="url"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="https://xyz.com/api/method/<endpoint>"
|
placeholder="https://xyz.com/api/action/<endpoint>"
|
||||||
/>
|
/>
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<FormControl
|
<FormControl
|
||||||
|
|||||||
@ -188,7 +188,7 @@ export default {
|
|||||||
async fetchTeams() {
|
async fetchTeams() {
|
||||||
try {
|
try {
|
||||||
const response = await jingrowRequest({
|
const response = await jingrowRequest({
|
||||||
url: '/api/method/jcloude.api.regional_payments.mpesa.utils.display_mpesa_payment_partners',
|
url: '/api/action/jcloude.api.regional_payments.mpesa.utils.display_mpesa_payment_partners',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
if (Array.isArray(response)) {
|
if (Array.isArray(response)) {
|
||||||
@ -208,7 +208,7 @@ export default {
|
|||||||
async fetchTaxPercentage() {
|
async fetchTaxPercentage() {
|
||||||
try {
|
try {
|
||||||
const taxPercentage = await jingrowRequest({
|
const taxPercentage = await jingrowRequest({
|
||||||
url: '/api/method/jcloude.api.regional_payments.mpesa.utils.get_tax_percentage',
|
url: '/api/action/jcloude.api.regional_payments.mpesa.utils.get_tax_percentage',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: {
|
params: {
|
||||||
payment_partner: this.partnerInput.value,
|
payment_partner: this.partnerInput.value,
|
||||||
|
|||||||
@ -172,7 +172,7 @@ export default {
|
|||||||
async fetchPartners() {
|
async fetchPartners() {
|
||||||
try {
|
try {
|
||||||
const response = await jingrowRequest({
|
const response = await jingrowRequest({
|
||||||
url: '/api/method/jcloude.api.regional_payments.mpesa.utils.display_payment_partners',
|
url: '/api/action/jcloude.api.regional_payments.mpesa.utils.display_payment_partners',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
if (Array.isArray(response)) {
|
if (Array.isArray(response)) {
|
||||||
@ -188,7 +188,7 @@ export default {
|
|||||||
async fetchPaymentGateway() {
|
async fetchPaymentGateway() {
|
||||||
try {
|
try {
|
||||||
const response = await jingrowRequest({
|
const response = await jingrowRequest({
|
||||||
url: '/api/method/jcloude.api.regional_payments.mpesa.utils.display_payment_gateway',
|
url: '/api/action/jcloude.api.regional_payments.mpesa.utils.display_payment_gateway',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
if (Array.isArray(response)) {
|
if (Array.isArray(response)) {
|
||||||
|
|||||||
@ -393,7 +393,7 @@ export default {
|
|||||||
this.$team.pg.payment_mode === 'Card'
|
this.$team.pg.payment_mode === 'Card'
|
||||||
) {
|
) {
|
||||||
window.open(
|
window.open(
|
||||||
`/api/method/jcloude.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`,
|
`/api/action/jcloude.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.showAddPrepaidCreditsDialog = true;
|
this.showAddPrepaidCreditsDialog = true;
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export default async function call(method, args) {
|
|||||||
|
|
||||||
updateState(this, 'RequestStarted', null);
|
updateState(this, 'RequestStarted', null);
|
||||||
|
|
||||||
const res = await fetch(`/api/method/${method}`, {
|
const res = await fetch(`/api/action/${method}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers,
|
headers,
|
||||||
body: JSON.stringify(args)
|
body: JSON.stringify(args)
|
||||||
|
|||||||
@ -64,7 +64,7 @@ export default class FileUploader {
|
|||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.open('POST', '/api/method/upload_file', true);
|
xhr.open('POST', '/api/action/upload_file', true);
|
||||||
xhr.setRequestHeader('Accept', 'application/json');
|
xhr.setRequestHeader('Accept', 'application/json');
|
||||||
if (window.csrf_token && window.csrf_token !== '{{ csrf_token }}') {
|
if (window.csrf_token && window.csrf_token !== '{{ csrf_token }}') {
|
||||||
xhr.setRequestHeader('X-Jingrow-CSRF-Token', window.csrf_token);
|
xhr.setRequestHeader('X-Jingrow-CSRF-Token', window.csrf_token);
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export default class S3FileUploader {
|
|||||||
async function getUploadLink() {
|
async function getUploadLink() {
|
||||||
try {
|
try {
|
||||||
let response = await fetch(
|
let response = await fetch(
|
||||||
`/api/method/jcloude.api.site.get_upload_link?file=${file.name}`
|
`/api/action/jcloude.api.site.get_upload_link?file=${file.name}`
|
||||||
);
|
);
|
||||||
let data = await response.json();
|
let data = await response.json();
|
||||||
return data.message;
|
return data.message;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ export async function switchToTeam(team) {
|
|||||||
let canSwitch = false;
|
let canSwitch = false;
|
||||||
try {
|
try {
|
||||||
canSwitch = await jingrowRequest({
|
canSwitch = await jingrowRequest({
|
||||||
url: '/api/method/jcloude.api.account.can_switch_to_team',
|
url: '/api/action/jcloude.api.account.can_switch_to_team',
|
||||||
params: { team },
|
params: { team },
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -62,7 +62,7 @@ export async function switchToTeam(team) {
|
|||||||
export async function isLastSite(team) {
|
export async function isLastSite(team) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
count = await jingrowRequest({
|
count = await jingrowRequest({
|
||||||
url: '/api/method/jcloude.api.account.get_site_count',
|
url: '/api/action/jcloude.api.account.get_site_count',
|
||||||
params: { team },
|
params: { team },
|
||||||
});
|
});
|
||||||
return Boolean(count === 1);
|
return Boolean(count === 1);
|
||||||
|
|||||||
@ -164,7 +164,7 @@ getInitialData().then(() => {
|
|||||||
function getInitialData() {
|
function getInitialData() {
|
||||||
if (import.meta.env.DEV) {
|
if (import.meta.env.DEV) {
|
||||||
return jingrowRequest({
|
return jingrowRequest({
|
||||||
url: '/api/method/jcloude.www.dashboard.get_context_for_dev',
|
url: '/api/action/jcloude.www.dashboard.get_context_for_dev',
|
||||||
}).then((values) => Object.assign(window, values));
|
}).then((values) => Object.assign(window, values));
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
|||||||
@ -66,7 +66,7 @@ export default {
|
|||||||
async onClick() {
|
async onClick() {
|
||||||
toast.promise(
|
toast.promise(
|
||||||
jingrowRequest({
|
jingrowRequest({
|
||||||
url: '/api/method/jcloude.api.notifications.mark_all_notifications_as_read',
|
url: '/api/action/jcloude.api.notifications.mark_all_notifications_as_read',
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
success: () => {
|
success: () => {
|
||||||
|
|||||||
@ -191,7 +191,7 @@ export default {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (row.stripe_invoice_url && row.payment_mode == 'Card') {
|
if (row.stripe_invoice_url && row.payment_mode == 'Card') {
|
||||||
window.open(
|
window.open(
|
||||||
`/api/method/jcloude.api.client.run_pg_method?dt=Invoice&dn=${row.name}&method=stripe_payment_url`,
|
`/api/action/jcloude.api.client.run_pg_method?dt=Invoice&dn=${row.name}&method=stripe_payment_url`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.showBuyPrepaidCreditsDialog = true;
|
this.showBuyPrepaidCreditsDialog = true;
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export default {
|
|||||||
this.loading = true;
|
this.loading = true;
|
||||||
try {
|
try {
|
||||||
const response = await jingrowRequest({
|
const response = await jingrowRequest({
|
||||||
url: '/api/method/jcloude.api.regional_payments.mpesa.utils.display_invoices_by_partner',
|
url: '/api/action/jcloude.api.regional_payments.mpesa.utils.display_invoices_by_partner',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
this.invoices = response;
|
this.invoices = response;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { expect, test } from './coverage.fixture';
|
|||||||
import mockResponse from '../../mocks/sites/get_list.json' assert { type: 'json' };
|
import mockResponse from '../../mocks/sites/get_list.json' assert { type: 'json' };
|
||||||
|
|
||||||
test('Ensure sites are visible in the list', async ({ page }) => {
|
test('Ensure sites are visible in the list', async ({ page }) => {
|
||||||
await page.route('*/**/api/method/jcloude.api.client.get_list', async route => {
|
await page.route('*/**/api/action/jcloude.api.client.get_list', async route => {
|
||||||
await route.fulfill({
|
await route.fulfill({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
|
|||||||
@ -350,7 +350,7 @@ server {
|
|||||||
http2_push_preload on;
|
http2_push_preload on;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/api/method/jcloude.api.developer.saas.* {
|
location ~ ^/api/action/jcloude.api.developer.saas.* {
|
||||||
if ($request_method = 'OPTIONS') {
|
if ($request_method = 'OPTIONS') {
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
|
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
|
||||||
|
|||||||
@ -497,7 +497,7 @@ class Agent:
|
|||||||
"site_backup": {
|
"site_backup": {
|
||||||
"name": site_backup.name,
|
"name": site_backup.name,
|
||||||
"snapshot_request_key": site_backup.snapshot_request_key,
|
"snapshot_request_key": site_backup.snapshot_request_key,
|
||||||
"snapshot_trigger_url": f"{jcloude_public_base_url}/api/method/jcloude.api.site_backup.create_snapshot",
|
"snapshot_trigger_url": f"{jcloude_public_base_url}/api/action/jcloude.api.site_backup.create_snapshot",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return self.create_agent_job(
|
return self.create_agent_job(
|
||||||
|
|||||||
@ -271,7 +271,7 @@ def send_login_link(email):
|
|||||||
minutes = 10
|
minutes = 10
|
||||||
jingrow.cache().set_value(f"one_time_login_key:{key}", email, expires_in_sec=minutes * 60)
|
jingrow.cache().set_value(f"one_time_login_key:{key}", email, expires_in_sec=minutes * 60)
|
||||||
|
|
||||||
link = get_url(f"/api/method/jcloude.api.account.login_using_key?key={key}")
|
link = get_url(f"/api/action/jcloude.api.account.login_using_key?key={key}")
|
||||||
|
|
||||||
if jingrow.conf.developer_mode:
|
if jingrow.conf.developer_mode:
|
||||||
print()
|
print()
|
||||||
|
|||||||
@ -307,7 +307,7 @@ class RequestGroupByChart(StackedGroupByChart):
|
|||||||
def setup_search_filters(self):
|
def setup_search_filters(self):
|
||||||
super().setup_search_filters()
|
super().setup_search_filters()
|
||||||
self.search = self.search.filter("match_phrase", json__transaction_type="request").exclude(
|
self.search = self.search.filter("match_phrase", json__transaction_type="request").exclude(
|
||||||
"match_phrase", json__request__path="/api/method/ping"
|
"match_phrase", json__request__path="/api/action/ping"
|
||||||
)
|
)
|
||||||
if ResourceType(self.resource_type) is ResourceType.SITE:
|
if ResourceType(self.resource_type) is ResourceType.SITE:
|
||||||
self.search = self.search.filter("match_phrase", json__site=self.name)
|
self.search = self.search.filter("match_phrase", json__site=self.name)
|
||||||
@ -891,7 +891,7 @@ class RunDocMethodMethodNames(RequestGroupByChart):
|
|||||||
def setup_search_filters(self):
|
def setup_search_filters(self):
|
||||||
super().setup_search_filters()
|
super().setup_search_filters()
|
||||||
self.group_by_field = "json.methodname"
|
self.group_by_field = "json.methodname"
|
||||||
self.search = self.search.filter("match_phrase", json__request__path="/api/method/run_pg_method")
|
self.search = self.search.filter("match_phrase", json__request__path="/api/action/run_pg_method")
|
||||||
|
|
||||||
def exclude_top_k_data(self, datasets: list[Dataset]):
|
def exclude_top_k_data(self, datasets: list[Dataset]):
|
||||||
if ResourceType(self.resource_type) is ResourceType.SITE:
|
if ResourceType(self.resource_type) is ResourceType.SITE:
|
||||||
@ -914,7 +914,7 @@ class QueryReportRunReports(RequestGroupByChart):
|
|||||||
super().setup_search_filters()
|
super().setup_search_filters()
|
||||||
self.group_by_field = "json.report"
|
self.group_by_field = "json.report"
|
||||||
self.search = self.search.filter(
|
self.search = self.search.filter(
|
||||||
"match_phrase", json__request__path="/api/method/jingrow.desk.query_report.run"
|
"match_phrase", json__request__path="/api/action/jingrow.desk.query_report.run"
|
||||||
)
|
)
|
||||||
|
|
||||||
def exclude_top_k_data(self, datasets: list[Dataset]):
|
def exclude_top_k_data(self, datasets: list[Dataset]):
|
||||||
@ -942,12 +942,12 @@ class CommonSlowPath(TypedDict):
|
|||||||
|
|
||||||
COMMONLY_SLOW_PATHS: list[CommonSlowPath] = [
|
COMMONLY_SLOW_PATHS: list[CommonSlowPath] = [
|
||||||
{
|
{
|
||||||
"path": "/api/method/run_pg_method",
|
"path": "/api/action/run_pg_method",
|
||||||
"id": "run_pg_method_methodnames",
|
"id": "run_pg_method_methodnames",
|
||||||
"function": get_run_pg_method_methodnames,
|
"function": get_run_pg_method_methodnames,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "/api/method/jingrow.desk.query_report.run",
|
"path": "/api/action/jingrow.desk.query_report.run",
|
||||||
"id": "query_report_run_reports",
|
"id": "query_report_run_reports",
|
||||||
"function": get_query_report_run_reports,
|
"function": get_query_report_run_reports,
|
||||||
},
|
},
|
||||||
@ -1179,7 +1179,7 @@ def request_logs(site, timezone, date, sort=None, start=0):
|
|||||||
{"match_phrase": {"json.site": site}},
|
{"match_phrase": {"json.site": site}},
|
||||||
{"range": {"@timestamp": {"gt": f"{date}||-1d/d", "lte": f"{date}||/d"}}},
|
{"range": {"@timestamp": {"gt": f"{date}||-1d/d", "lte": f"{date}||/d"}}},
|
||||||
],
|
],
|
||||||
"must_not": [{"match_phrase": {"json.request.path": "/api/method/ping"}}],
|
"must_not": [{"match_phrase": {"json.request.path": "/api/action/ping"}}],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sort": sort_value,
|
"sort": sort_value,
|
||||||
|
|||||||
@ -863,7 +863,7 @@ def generate_stk_push(**kwargs):
|
|||||||
mpesa_setup = get_mpesa_setup_for_team(partner[0])
|
mpesa_setup = get_mpesa_setup_for_team(partner[0])
|
||||||
try:
|
try:
|
||||||
callback_url = (
|
callback_url = (
|
||||||
get_request_site_address(True) + "/api/method/jcloude.api.billing.verify_m_pesa_transaction"
|
get_request_site_address(True) + "/api/action/jcloude.api.billing.verify_m_pesa_transaction"
|
||||||
)
|
)
|
||||||
env = "production" if not mpesa_setup.sandbox else "sandbox"
|
env = "production" if not mpesa_setup.sandbox else "sandbox"
|
||||||
# for sandbox, business shortcode is same as till number
|
# for sandbox, business shortcode is same as till number
|
||||||
|
|||||||
@ -160,7 +160,7 @@ class DeveloperApiHandler:
|
|||||||
jingrow.db.commit()
|
jingrow.db.commit()
|
||||||
|
|
||||||
return get_url(
|
return get_url(
|
||||||
f"/api/method/jcloude.api.marketplace.login_via_token?token={token}&team={team}&site={self.app_subscription_pg.site}"
|
f"/api/action/jcloude.api.marketplace.login_via_token?token={token}&team={team}&site={self.app_subscription_pg.site}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -73,7 +73,7 @@ class SaasApiHandler:
|
|||||||
).insert(ignore_permissions=True)
|
).insert(ignore_permissions=True)
|
||||||
|
|
||||||
domain = jingrow.db.get_value("Saas App", self.app_subscription_pg.app, "custom_domain")
|
domain = jingrow.db.get_value("Saas App", self.app_subscription_pg.app, "custom_domain")
|
||||||
return f"https://{domain}/api/method/jcloude.api.saas.login_via_token?token={token}&team={self.app_subscription_pg.team}"
|
return f"https://{domain}/api/action/jcloude.api.saas.login_via_token?token={token}&team={self.app_subscription_pg.team}"
|
||||||
|
|
||||||
def get_trial_expiry(self):
|
def get_trial_expiry(self):
|
||||||
return jingrow.db.get_value("Site", self.app_subscription_pg.site, "trial_end_date")
|
return jingrow.db.get_value("Site", self.app_subscription_pg.site, "trial_end_date")
|
||||||
|
|||||||
@ -317,7 +317,7 @@ def event_log():
|
|||||||
try:
|
try:
|
||||||
host_name = jingrow.db.get_value("Site", site, "host_name") or site
|
host_name = jingrow.db.get_value("Site", site, "host_name") or site
|
||||||
requests.post(
|
requests.post(
|
||||||
f"https://{host_name}/api/method/email_delivery_service.controller.update_status",
|
f"https://{host_name}/api/action/email_delivery_service.controller.update_status",
|
||||||
data=data,
|
data=data,
|
||||||
)
|
)
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
|
|||||||
@ -1184,7 +1184,7 @@ def get_discount_percent(plan, discount=0.0):
|
|||||||
if team.jerp_partner and jingrow.get_value("Marketplace App Plan", plan, "partner_discount"):
|
if team.jerp_partner and jingrow.get_value("Marketplace App Plan", plan, "partner_discount"):
|
||||||
client = get_jingrow_io_connection()
|
client = get_jingrow_io_connection()
|
||||||
response = client.session.post(
|
response = client.session.post(
|
||||||
f"{client.url}/api/method/partner_relationship_management.api.get_partner_type",
|
f"{client.url}/api/action/partner_relationship_management.api.get_partner_type",
|
||||||
data={"email": team.partner_email},
|
data={"email": team.partner_email},
|
||||||
headers=client.headers,
|
headers=client.headers,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1097,7 +1097,7 @@ def get(name):
|
|||||||
site_name = jingrow.db.get_value("Site Domain", name, "site")
|
site_name = jingrow.db.get_value("Site Domain", name, "site")
|
||||||
if site_name:
|
if site_name:
|
||||||
jingrow.local.response["type"] = "redirect"
|
jingrow.local.response["type"] = "redirect"
|
||||||
jingrow.local.response["location"] = f"/api/method/jcloude.api.site.get?name={site_name}"
|
jingrow.local.response["location"] = f"/api/action/jcloude.api.site.get?name={site_name}"
|
||||||
return None
|
return None
|
||||||
raise
|
raise
|
||||||
rg_info = jingrow.db.get_value("Release Group", site.group, ["team", "version", "public"], as_dict=True)
|
rg_info = jingrow.db.get_value("Release Group", site.group, ["team", "version", "public"], as_dict=True)
|
||||||
|
|||||||
@ -12,50 +12,50 @@ JCLOUDE_AUTH_MAX_ENTRIES = 1000000
|
|||||||
|
|
||||||
|
|
||||||
ALLOWED_PATHS = [
|
ALLOWED_PATHS = [
|
||||||
"/api/method/create-site-migration",
|
"/api/action/create-site-migration",
|
||||||
"/api/method/create-version-upgrade",
|
"/api/action/create-version-upgrade",
|
||||||
"/api/method/migrate-to-private-bench",
|
"/api/action/migrate-to-private-bench",
|
||||||
"/api/method/find-my-sites",
|
"/api/action/find-my-sites",
|
||||||
"/api/method/jingrow.core.pagetype.communication.email.mark_email_as_seen",
|
"/api/action/jingrow.core.pagetype.communication.email.mark_email_as_seen",
|
||||||
"/api/method/jingrow.realtime.get_user_info",
|
"/api/action/jingrow.realtime.get_user_info",
|
||||||
"/api/method/jingrow.realtime.can_subscribe_pg",
|
"/api/action/jingrow.realtime.can_subscribe_pg",
|
||||||
"/api/method/jingrow.realtime.can_subscribe_pagetype",
|
"/api/action/jingrow.realtime.can_subscribe_pagetype",
|
||||||
"/api/method/jingrow.realtime.has_permission",
|
"/api/action/jingrow.realtime.has_permission",
|
||||||
"/api/method/jingrow.www.login.login_via_jingrow",
|
"/api/action/jingrow.www.login.login_via_jingrow",
|
||||||
"/api/method/jingrow.integrations.oauth2.authorize",
|
"/api/action/jingrow.integrations.oauth2.authorize",
|
||||||
"/api/method/jingrow.integrations.oauth2.approve",
|
"/api/action/jingrow.integrations.oauth2.approve",
|
||||||
"/api/method/jingrow.integrations.oauth2.get_token",
|
"/api/action/jingrow.integrations.oauth2.get_token",
|
||||||
"/api/method/jingrow.integrations.oauth2.openid_profile",
|
"/api/action/jingrow.integrations.oauth2.openid_profile",
|
||||||
"/api/method/jingrow.integrations.oauth2_logins.login_via_jingrow",
|
"/api/action/jingrow.integrations.oauth2_logins.login_via_jingrow",
|
||||||
"/api/method/jingrow.website.pagetype.web_page_view.web_page_view.make_view_log",
|
"/api/action/jingrow.website.pagetype.web_page_view.web_page_view.make_view_log",
|
||||||
"/api/method/jingrow.desk.form.utils.add_comment",
|
"/api/action/jingrow.desk.form.utils.add_comment",
|
||||||
"/api/method/get-user-sites-list-for-new-ticket",
|
"/api/action/get-user-sites-list-for-new-ticket",
|
||||||
"/api/method/ping",
|
"/api/action/ping",
|
||||||
"/api/method/login",
|
"/api/action/login",
|
||||||
"/api/method/logout",
|
"/api/action/logout",
|
||||||
"/api/method/jcloude.jcloude.pagetype.razorpay_webhook_log.razorpay_webhook_log.razorpay_webhook_handler",
|
"/api/action/jcloude.jcloude.pagetype.razorpay_webhook_log.razorpay_webhook_log.razorpay_webhook_handler",
|
||||||
"/api/method/jcloude.jcloude.pagetype.razorpay_webhook_log.razorpay_webhook_log.razorpay_authorized_payment_handler",
|
"/api/action/jcloude.jcloude.pagetype.razorpay_webhook_log.razorpay_webhook_log.razorpay_authorized_payment_handler",
|
||||||
"/api/method/jcloude.jcloude.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler",
|
"/api/action/jcloude.jcloude.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler",
|
||||||
"/api/method/jcloude.jcloude.pagetype.drip_email.drip_email.unsubscribe",
|
"/api/action/jcloude.jcloude.pagetype.drip_email.drip_email.unsubscribe",
|
||||||
"/api/method/upload_file",
|
"/api/action/upload_file",
|
||||||
"/api/method/jingrow.search.web_search",
|
"/api/action/jingrow.search.web_search",
|
||||||
"/api/method/jingrow.email.queue.unsubscribe",
|
"/api/action/jingrow.email.queue.unsubscribe",
|
||||||
"/api/method/jcloude.utils.telemetry.capture_read_event",
|
"/api/action/jcloude.utils.telemetry.capture_read_event",
|
||||||
"/api/method/validate_plan_change",
|
"/api/action/validate_plan_change",
|
||||||
"/api/method/marketplace-apps",
|
"/api/action/marketplace-apps",
|
||||||
"/api/method/jcloude.www.dashboard.get_context_for_dev",
|
"/api/action/jcloude.www.dashboard.get_context_for_dev",
|
||||||
"/api/method/jingrow.website.pagetype.web_form.web_form.accept",
|
"/api/action/jingrow.website.pagetype.web_form.web_form.accept",
|
||||||
"/api/method/jingrow.core.pagetype.user.user.test_password_strength",
|
"/api/action/jingrow.core.pagetype.user.user.test_password_strength",
|
||||||
"/api/method/jingrow.core.pagetype.user.user.update_password",
|
"/api/action/jingrow.core.pagetype.user.user.update_password",
|
||||||
"/api/method/get_central_migration_data",
|
"/api/action/get_central_migration_data",
|
||||||
]
|
]
|
||||||
|
|
||||||
ALLOWED_WILDCARD_PATHS = [
|
ALLOWED_WILDCARD_PATHS = [
|
||||||
"/api/method/jcloude.api.",
|
"/api/action/jcloude.api.",
|
||||||
"/api/method/jcloude.saas.",
|
"/api/action/jcloude.saas.",
|
||||||
"/api/method/wiki.",
|
"/api/action/wiki.",
|
||||||
"/api/method/jingrow.integrations.oauth2_logins.",
|
"/api/action/jingrow.integrations.oauth2_logins.",
|
||||||
"/api/method/jcloude.www.marketplace.index.",
|
"/api/action/jcloude.www.marketplace.index.",
|
||||||
]
|
]
|
||||||
|
|
||||||
DENIED_PATHS = [
|
DENIED_PATHS = [
|
||||||
@ -72,7 +72,7 @@ DENIED_WILDCARD_PATHS = [
|
|||||||
|
|
||||||
def hook(): # noqa: C901
|
def hook(): # noqa: C901
|
||||||
if jingrow.form_dict.cmd:
|
if jingrow.form_dict.cmd:
|
||||||
path = f"/api/method/{jingrow.form_dict.cmd}"
|
path = f"/api/action/{jingrow.form_dict.cmd}"
|
||||||
else:
|
else:
|
||||||
path = jingrow.request.path
|
path = jingrow.request.path
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ def start_ngrok_and_set_webhook(context):
|
|||||||
print(f"Inspect logs at {tunnel.api_url}")
|
print(f"Inspect logs at {tunnel.api_url}")
|
||||||
|
|
||||||
stripe = get_stripe()
|
stripe = get_stripe()
|
||||||
url = f"{public_url}/api/method/jcloude.jcloude.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler"
|
url = f"{public_url}/api/action/jcloude.jcloude.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler"
|
||||||
stripe.WebhookEndpoint.modify(
|
stripe.WebhookEndpoint.modify(
|
||||||
jingrow.db.get_single_value("Jcloude Settings", "stripe_webhook_endpoint_id"), url=url
|
jingrow.db.get_single_value("Jcloude Settings", "stripe_webhook_endpoint_id"), url=url
|
||||||
)
|
)
|
||||||
|
|||||||
@ -72,7 +72,7 @@ website_redirects = [
|
|||||||
{"source": "/dashboard/f-login", "target": get_jingrow_io_auth_url() or "/"},
|
{"source": "/dashboard/f-login", "target": get_jingrow_io_auth_url() or "/"},
|
||||||
{
|
{
|
||||||
"source": "/suspended-site",
|
"source": "/suspended-site",
|
||||||
"target": "/api/method/jcloude.api.handle_suspended_site_redirection",
|
"target": "/api/action/jcloude.api.handle_suspended_site_redirection",
|
||||||
},
|
},
|
||||||
{"source": "/f-login", "target": "/dashboard/f-login"},
|
{"source": "/f-login", "target": "/dashboard/f-login"},
|
||||||
{"source": "/signup", "target": "/jerp/signup"},
|
{"source": "/signup", "target": "/jerp/signup"},
|
||||||
|
|||||||
@ -191,7 +191,7 @@ class IncidentInvestigator(Page):
|
|||||||
|
|
||||||
def ping(url: str) -> int:
|
def ping(url: str) -> int:
|
||||||
try:
|
try:
|
||||||
return requests.get(f"https://{url}/api/method/ping", timeout=5).status_code
|
return requests.get(f"https://{url}/api/action/ping", timeout=5).status_code
|
||||||
except Exception:
|
except Exception:
|
||||||
return 502
|
return 502
|
||||||
|
|
||||||
|
|||||||
@ -247,7 +247,7 @@ class AccountRequest(Page):
|
|||||||
"invited_by": self.invited_by,
|
"invited_by": self.invited_by,
|
||||||
"link": url,
|
"link": url,
|
||||||
"read_pixel_path": get_url(
|
"read_pixel_path": get_url(
|
||||||
f"/api/method/jcloude.utils.telemetry.capture_read_event?email={self.email}"
|
f"/api/action/jcloude.utils.telemetry.capture_read_event?email={self.email}"
|
||||||
),
|
),
|
||||||
"otp": self.otp,
|
"otp": self.otp,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -572,12 +572,12 @@ def analyze_sites(sites: list):
|
|||||||
try:
|
try:
|
||||||
# If there are redirects, follow it and log those
|
# If there are redirects, follow it and log those
|
||||||
done = False
|
done = False
|
||||||
url = f"https://{site}/api/method/ping"
|
url = f"https://{site}/api/action/ping"
|
||||||
while not done:
|
while not done:
|
||||||
response = requests.get(url, timeout=(2, 10), allow_redirects=False)
|
response = requests.get(url, timeout=(2, 10), allow_redirects=False)
|
||||||
# Record status code
|
# Record status code
|
||||||
results[site]["status_code"] = response.status_code
|
results[site]["status_code"] = response.status_code
|
||||||
# Check if we are getting redirected to some other server in /api/method/ping check
|
# Check if we are getting redirected to some other server in /api/action/ping check
|
||||||
results[site]["proxy_server"] = response.headers.get(
|
results[site]["proxy_server"] = response.headers.get(
|
||||||
"Server", ""
|
"Server", ""
|
||||||
) or response.headers.get("server", "")
|
) or response.headers.get("server", "")
|
||||||
|
|||||||
@ -302,7 +302,7 @@ class Incident(WebsiteGenerator):
|
|||||||
if not (site := self.get_down_site()):
|
if not (site := self.get_down_site()):
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
ret = requests.get(f"https://{site}/api/method/ping", timeout=10)
|
ret = requests.get(f"https://{site}/api/action/ping", timeout=10)
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
self.add_description(f"Error pinging sample site {site}: {e!s}")
|
self.add_description(f"Error pinging sample site {site}: {e!s}")
|
||||||
return None
|
return None
|
||||||
@ -687,7 +687,7 @@ Likely due to insufficient balance or incorrect credentials""",
|
|||||||
|
|
||||||
jcloude_public_base_url = jingrow.utils.get_url()
|
jcloude_public_base_url = jingrow.utils.get_url()
|
||||||
twilio_client.calls.create(
|
twilio_client.calls.create(
|
||||||
url=f"{jcloude_public_base_url}/api/method/jcloude.api.message.confirmed_incident?server_title={server_title_encoded}",
|
url=f"{jcloude_public_base_url}/api/action/jcloude.api.message.confirmed_incident?server_title={server_title_encoded}",
|
||||||
to=phone_no,
|
to=phone_no,
|
||||||
from_=from_phone,
|
from_=from_phone,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -828,7 +828,7 @@ class Invoice(Page):
|
|||||||
def get_pdf(self):
|
def get_pdf(self):
|
||||||
print_format = self.meta.default_print_format
|
print_format = self.meta.default_print_format
|
||||||
return jingrow.utils.get_url(
|
return jingrow.utils.get_url(
|
||||||
f"/api/method/jingrow.utils.print_format.download_pdf?pagetype=Invoice&name={self.name}&format={print_format}&no_letterhead=0"
|
f"/api/action/jingrow.utils.print_format.download_pdf?pagetype=Invoice&name={self.name}&format={print_format}&no_letterhead=0"
|
||||||
)
|
)
|
||||||
|
|
||||||
@jingrow.whitelist()
|
@jingrow.whitelist()
|
||||||
@ -856,7 +856,7 @@ class Invoice(Page):
|
|||||||
return None
|
return None
|
||||||
client = self.get_jingrowio_connection()
|
client = self.get_jingrowio_connection()
|
||||||
response = client.session.post(
|
response = client.session.post(
|
||||||
f"{client.url}/api/method/create-fc-invoice",
|
f"{client.url}/api/action/create-fc-invoice",
|
||||||
headers=client.headers,
|
headers=client.headers,
|
||||||
data={
|
data={
|
||||||
"team": team.as_json(),
|
"team": team.as_json(),
|
||||||
@ -912,7 +912,7 @@ class Invoice(Page):
|
|||||||
"no_letterhead": 0,
|
"no_letterhead": 0,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
url = client.url + "/api/method/jingrow.utils.print_format.download_pdf?" + params
|
url = client.url + "/api/action/jingrow.utils.print_format.download_pdf?" + params
|
||||||
|
|
||||||
with client.session.get(url, headers=client.headers, stream=True) as r:
|
with client.session.get(url, headers=client.headers, stream=True) as r:
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
@ -1011,7 +1011,7 @@ class Invoice(Page):
|
|||||||
"no_letterhead": 0,
|
"no_letterhead": 0,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
url = f"{client.url}/api/method/jingrow.utils.print_format.download_pdf?{params}"
|
url = f"{client.url}/api/action/jingrow.utils.print_format.download_pdf?{params}"
|
||||||
|
|
||||||
with client.session.get(url, headers=client.headers, stream=True) as r:
|
with client.session.get(url, headers=client.headers, stream=True) as r:
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
@ -1229,7 +1229,7 @@ def create_sales_invoice_on_external_site(transaction_response):
|
|||||||
|
|
||||||
# Post to the external site's sales invoice creation API
|
# Post to the external site's sales invoice creation API
|
||||||
response = client.session.post(
|
response = client.session.post(
|
||||||
f"{client.url}/api/method/jingrow.client.insert",
|
f"{client.url}/api/action/jingrow.client.insert",
|
||||||
headers=client.headers,
|
headers=client.headers,
|
||||||
json={"pg": data},
|
json={"pg": data},
|
||||||
)
|
)
|
||||||
|
|||||||
@ -215,7 +215,7 @@ class JcloudeSettings(Page):
|
|||||||
def create_stripe_webhook(self):
|
def create_stripe_webhook(self):
|
||||||
stripe = get_stripe()
|
stripe = get_stripe()
|
||||||
url = jingrow.utils.get_url(
|
url = jingrow.utils.get_url(
|
||||||
"/api/method/jcloude.jcloude.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler"
|
"/api/action/jcloude.jcloude.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler"
|
||||||
)
|
)
|
||||||
webhook = stripe.WebhookEndpoint.create(
|
webhook = stripe.WebhookEndpoint.create(
|
||||||
url=url,
|
url=url,
|
||||||
|
|||||||
@ -486,7 +486,7 @@ class ReleaseGroup(Page, TagHelpers):
|
|||||||
with suppress(AttributeError, RuntimeError):
|
with suppress(AttributeError, RuntimeError):
|
||||||
if (
|
if (
|
||||||
not jingrow.flags.in_test
|
not jingrow.flags.in_test
|
||||||
and jingrow.request.path == "/api/method/jcloude.api.bench.change_branch"
|
and jingrow.request.path == "/api/action/jcloude.api.bench.change_branch"
|
||||||
):
|
):
|
||||||
return # Separate validation exists in set_app_source
|
return # Separate validation exists in set_app_source
|
||||||
for app in self.apps:
|
for app in self.apps:
|
||||||
@ -1010,7 +1010,7 @@ class ReleaseGroup(Page, TagHelpers):
|
|||||||
}
|
}
|
||||||
).insert()
|
).insert()
|
||||||
|
|
||||||
link = get_url(f"/api/method/jcloude.api.bench.confirm_bench_transfer?key={key}")
|
link = get_url(f"/api/action/jcloude.api.bench.confirm_bench_transfer?key={key}")
|
||||||
|
|
||||||
if jingrow.conf.developer_mode:
|
if jingrow.conf.developer_mode:
|
||||||
print(f"Bench transfer link for {team_mail_id}\n{link}\n")
|
print(f"Bench transfer link for {team_mail_id}\n{link}\n")
|
||||||
|
|||||||
@ -1656,7 +1656,7 @@ class Site(Page, TagHelpers):
|
|||||||
}
|
}
|
||||||
).insert()
|
).insert()
|
||||||
|
|
||||||
link = get_url(f"/api/method/jcloude.api.site.confirm_site_transfer?key={key}")
|
link = get_url(f"/api/action/jcloude.api.site.confirm_site_transfer?key={key}")
|
||||||
|
|
||||||
if jingrow.conf.developer_mode:
|
if jingrow.conf.developer_mode:
|
||||||
print(f"\nSite transfer link for {team_mail_id}\n{link}\n")
|
print(f"\nSite transfer link for {team_mail_id}\n{link}\n")
|
||||||
@ -1785,7 +1785,7 @@ class Site(Page, TagHelpers):
|
|||||||
if user == "Administrator":
|
if user == "Administrator":
|
||||||
password = get_decrypted_password("Site", self.name, "admin_password")
|
password = get_decrypted_password("Site", self.name, "admin_password")
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"https://{self.name}/api/method/login",
|
f"https://{self.name}/api/action/login",
|
||||||
data={"usr": user, "pwd": password},
|
data={"usr": user, "pwd": password},
|
||||||
)
|
)
|
||||||
sid = response.cookies.get("sid")
|
sid = response.cookies.get("sid")
|
||||||
@ -1952,7 +1952,7 @@ class Site(Page, TagHelpers):
|
|||||||
"pagetype": "Webhook",
|
"pagetype": "Webhook",
|
||||||
"webhook_pagetype": "User",
|
"webhook_pagetype": "User",
|
||||||
"enabled": 1,
|
"enabled": 1,
|
||||||
"request_url": "https://jcloud.jingrow.com/api/method/jcloude.api.site_login.sync_product_site_user",
|
"request_url": "https://jcloud.jingrow.com/api/action/jcloude.api.site_login.sync_product_site_user",
|
||||||
"request_method": "POST",
|
"request_method": "POST",
|
||||||
"request_structure": "JSON",
|
"request_structure": "JSON",
|
||||||
"webhook_json": """{ "user_info": { "email": "{{pg.email}}", "enabled": "{{pg.enabled}}" } }""",
|
"webhook_json": """{ "user_info": { "email": "{{pg.email}}", "enabled": "{{pg.enabled}}" } }""",
|
||||||
@ -2095,7 +2095,7 @@ class Site(Page, TagHelpers):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
return requests.get(f"https://{self.name}/api/method/ping", timeout=5)
|
return requests.get(f"https://{self.name}/api/action/ping", timeout=5)
|
||||||
|
|
||||||
def _set_configuration(self, config: list[dict]):
|
def _set_configuration(self, config: list[dict]):
|
||||||
"""Similar to _update_configuration but will replace full configuration at once
|
"""Similar to _update_configuration but will replace full configuration at once
|
||||||
@ -2344,7 +2344,7 @@ class Site(Page, TagHelpers):
|
|||||||
|
|
||||||
# Send ping request
|
# Send ping request
|
||||||
try:
|
try:
|
||||||
resp = requests.get(f"https://{self.host_name}/api/method/ping", timeout=5, verify=True)
|
resp = requests.get(f"https://{self.host_name}/api/action/ping", timeout=5, verify=True)
|
||||||
is_pingable = resp.status_code == 200
|
is_pingable = resp.status_code == 200
|
||||||
if not is_pingable:
|
if not is_pingable:
|
||||||
result.update(
|
result.update(
|
||||||
|
|||||||
@ -1026,7 +1026,7 @@ class Team(Page):
|
|||||||
|
|
||||||
client = get_jingrow_io_connection()
|
client = get_jingrow_io_connection()
|
||||||
response = client.session.get(
|
response = client.session.get(
|
||||||
f"{client.url}/api/method/get_partner_level",
|
f"{client.url}/api/action/get_partner_level",
|
||||||
headers=client.headers,
|
headers=client.headers,
|
||||||
params={"email": self.partner_email},
|
params={"email": self.partner_email},
|
||||||
)
|
)
|
||||||
|
|||||||
@ -120,7 +120,7 @@ class TeamDeletionRequest(PersonalDataDeletionRequest):
|
|||||||
|
|
||||||
def generate_url_for_confirmation(self):
|
def generate_url_for_confirmation(self):
|
||||||
params = get_signed_params({"team": self.team})
|
params = get_signed_params({"team": self.team})
|
||||||
api = jingrow.utils.get_url("/api/method/jcloude.api.account.delete_team")
|
api = jingrow.utils.get_url("/api/action/jcloude.api.account.delete_team")
|
||||||
url = f"{api}?{params}"
|
url = f"{api}?{params}"
|
||||||
|
|
||||||
if jingrow.conf.developer_mode:
|
if jingrow.conf.developer_mode:
|
||||||
@ -164,7 +164,7 @@ class TeamDeletionRequest(PersonalDataDeletionRequest):
|
|||||||
|
|
||||||
client = get_jingrow_io_connection()
|
client = get_jingrow_io_connection()
|
||||||
response = client.session.delete(
|
response = client.session.delete(
|
||||||
f"{client.url}/api/method/delete-fc-team",
|
f"{client.url}/api/action/delete-fc-team",
|
||||||
data={"team": self.team},
|
data={"team": self.team},
|
||||||
headers=client.headers,
|
headers=client.headers,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class TestTeamDeletionRequest(JingrowTestCase):
|
|||||||
def test_url_for_verification(self):
|
def test_url_for_verification(self):
|
||||||
deletion_url = self.team_deletion_request.generate_url_for_confirmation()
|
deletion_url = self.team_deletion_request.generate_url_for_confirmation()
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
deletion_url.startswith(jingrow.utils.get_url("/api/method/jcloude.api.account.delete_team"))
|
deletion_url.startswith(jingrow.utils.get_url("/api/action/jcloude.api.account.delete_team"))
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_team_deletion_api(self):
|
def test_team_deletion_api(self):
|
||||||
|
|||||||
@ -155,7 +155,7 @@ class MarketplaceAppSubscription(Page):
|
|||||||
try:
|
try:
|
||||||
for path in paths:
|
for path in paths:
|
||||||
requests.post(
|
requests.post(
|
||||||
f"https://{self.site}/api/method/{path}",
|
f"https://{self.site}/api/action/{path}",
|
||||||
data={"app": self.app, "plan": self.plan},
|
data={"app": self.app, "plan": self.plan},
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class CertificateLinkRequest(Page):
|
|||||||
jingrow.db.set_value("Partner Certificate", certs[0], "partner_team", self.partner_team)
|
jingrow.db.set_value("Partner Certificate", certs[0], "partner_team", self.partner_team)
|
||||||
|
|
||||||
def after_insert(self):
|
def after_insert(self):
|
||||||
link = get_url(f"/api/method/jcloude.api.partner.approve_certificate_link_request?key={self.key}")
|
link = get_url(f"/api/action/jcloude.api.partner.approve_certificate_link_request?key={self.key}")
|
||||||
|
|
||||||
jingrow.sendmail(
|
jingrow.sendmail(
|
||||||
recipients=[self.user_email],
|
recipients=[self.user_email],
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class PartnerApprovalRequest(Page):
|
|||||||
jingrow.throw("Failed to create approval request. Please contact support.")
|
jingrow.throw("Failed to create approval request. Please contact support.")
|
||||||
customer = jingrow.db.get_value("Team", self.requested_by, "user")
|
customer = jingrow.db.get_value("Team", self.requested_by, "user")
|
||||||
|
|
||||||
link = get_url(f"/api/method/jcloude.api.partner.approve_partner_request?key={self.key}")
|
link = get_url(f"/api/action/jcloude.api.partner.approve_partner_request?key={self.key}")
|
||||||
|
|
||||||
jingrow.sendmail(
|
jingrow.sendmail(
|
||||||
subject="Partner Approval Request",
|
subject="Partner Approval Request",
|
||||||
|
|||||||
@ -59,7 +59,7 @@ scrape_configs:
|
|||||||
target_label: __param_target
|
target_label: __param_target
|
||||||
- source_labels: [__param_target]
|
- source_labels: [__param_target]
|
||||||
target_label: instance
|
target_label: instance
|
||||||
regex: 'https://(.*)/api/method/ping'
|
regex: 'https://(.*)/api/action/ping'
|
||||||
- target_label: __address__
|
- target_label: __address__
|
||||||
replacement: '{{ server }}'
|
replacement: '{{ server }}'
|
||||||
file_sd_configs:
|
file_sd_configs:
|
||||||
@ -80,7 +80,7 @@ scrape_configs:
|
|||||||
target_label: __param_target
|
target_label: __param_target
|
||||||
- source_labels: [__param_target]
|
- source_labels: [__param_target]
|
||||||
target_label: instance
|
target_label: instance
|
||||||
regex: 'https://(.*)/api/method/ping'
|
regex: 'https://(.*)/api/action/ping'
|
||||||
- target_label: __address__
|
- target_label: __address__
|
||||||
replacement: '{{ server }}'
|
replacement: '{{ server }}'
|
||||||
file_sd_configs:
|
file_sd_configs:
|
||||||
|
|||||||
@ -6,6 +6,6 @@ OIDC_CLIENT_SECRET = "{{ sentry_oauth_client_secret }}"
|
|||||||
OIDC_ISSUER = "Jingrow"
|
OIDC_ISSUER = "Jingrow"
|
||||||
OIDC_SCOPE = "openid email"
|
OIDC_SCOPE = "openid email"
|
||||||
|
|
||||||
OIDC_AUTHORIZATION_ENDPOINT = "{{ sentry_oauth_server_url }}/api/method/jingrow.integrations.oauth2.authorize"
|
OIDC_AUTHORIZATION_ENDPOINT = "{{ sentry_oauth_server_url }}/api/action/jingrow.integrations.oauth2.authorize"
|
||||||
OIDC_TOKEN_ENDPOINT = "{{ sentry_oauth_server_url }}/api/method/jingrow.integrations.oauth2.get_token"
|
OIDC_TOKEN_ENDPOINT = "{{ sentry_oauth_server_url }}/api/action/jingrow.integrations.oauth2.get_token"
|
||||||
OIDC_USERINFO_ENDPOINT = "{{ sentry_oauth_server_url }}/api/method/jingrow.integrations.oauth2.openid_profile"
|
OIDC_USERINFO_ENDPOINT = "{{ sentry_oauth_server_url }}/api/action/jingrow.integrations.oauth2.openid_profile"
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export default async function call(method, args) {
|
|||||||
headers['X-Jingrow-CSRF-Token'] = window.csrf_token;
|
headers['X-Jingrow-CSRF-Token'] = window.csrf_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch(`/api/method/${method}`, {
|
const res = await fetch(`/api/action/${method}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers,
|
headers,
|
||||||
body: JSON.stringify(args),
|
body: JSON.stringify(args),
|
||||||
|
|||||||
@ -10,7 +10,7 @@ from html2text import html2text
|
|||||||
|
|
||||||
def get_remote_script(remote_site):
|
def get_remote_script(remote_site):
|
||||||
print("Retrieving Site Migrator...")
|
print("Retrieving Site Migrator...")
|
||||||
request_url = f"https://{remote_site}/api/method/jcloude.api.script"
|
request_url = f"https://{remote_site}/api/action/jcloude.api.script"
|
||||||
request = requests.get(request_url)
|
request = requests.get(request_url)
|
||||||
|
|
||||||
if request.status_code / 100 != 2:
|
if request.status_code / 100 != 2:
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import requests
|
|||||||
def jingrowcloud_migrator():
|
def jingrowcloud_migrator():
|
||||||
print("Retreiving Site Migrator...")
|
print("Retreiving Site Migrator...")
|
||||||
remote_site = "jcloud.jingrow.com"
|
remote_site = "jcloud.jingrow.com"
|
||||||
request_url = "https://{}/api/method/jcloude.api.script_2".format(remote_site)
|
request_url = "https://{}/api/action/jcloude.api.script_2".format(remote_site)
|
||||||
request = requests.get(request_url)
|
request = requests.get(request_url)
|
||||||
|
|
||||||
if request.status_code / 100 != 2:
|
if request.status_code / 100 != 2:
|
||||||
|
|||||||
@ -30,7 +30,7 @@ Sometimes, we may need to pass the secret token to frontend for some specific ta
|
|||||||
**Request**
|
**Request**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --location --request POST 'http://fc.local:8000/api/method/jcloude.saas.api.auth.generate_access_token' \
|
curl --location --request POST 'http://fc.local:8000/api/action/jcloude.saas.api.auth.generate_access_token' \
|
||||||
--header 'x-site: oka-hdz-qpj.tanmoy.fc.jingrow.dev' \
|
--header 'x-site: oka-hdz-qpj.tanmoy.fc.jingrow.dev' \
|
||||||
--header 'x-site-token: 004f85a3ae93927d2f0fcc668d11cb71'
|
--header 'x-site-token: 004f85a3ae93927d2f0fcc668d11cb71'
|
||||||
```
|
```
|
||||||
|
|||||||
@ -471,32 +471,32 @@ def jingrowcloud_migrator(local_site, jingrow_provider):
|
|||||||
remote_site = jingrow_provider or jingrow.conf.jingrowcloud_url
|
remote_site = jingrow_provider or jingrow.conf.jingrowcloud_url
|
||||||
scheme = "https"
|
scheme = "https"
|
||||||
|
|
||||||
login_url = "{}://{}/api/method/login".format(scheme, remote_site)
|
login_url = "{}://{}/api/action/login".format(scheme, remote_site)
|
||||||
upload_url = "{}://{}/api/method/jcloude.api.site.new".format(scheme, remote_site)
|
upload_url = "{}://{}/api/action/jcloude.api.site.new".format(scheme, remote_site)
|
||||||
remote_link_url = "{}://{}/api/method/jcloude.api.site.get_upload_link".format(
|
remote_link_url = "{}://{}/api/action/jcloude.api.site.get_upload_link".format(
|
||||||
scheme, remote_site
|
scheme, remote_site
|
||||||
)
|
)
|
||||||
register_remote_url = "{}://{}/api/method/jcloude.api.site.uploaded_backup_info".format(
|
register_remote_url = "{}://{}/api/action/jcloude.api.site.uploaded_backup_info".format(
|
||||||
scheme, remote_site
|
scheme, remote_site
|
||||||
)
|
)
|
||||||
options_url = "{}://{}/api/method/jcloude.api.site.options_for_new".format(
|
options_url = "{}://{}/api/action/jcloude.api.site.options_for_new".format(
|
||||||
scheme, remote_site
|
scheme, remote_site
|
||||||
)
|
)
|
||||||
site_exists_url = "{}://{}/api/method/jcloude.api.site.exists".format(
|
site_exists_url = "{}://{}/api/action/jcloude.api.site.exists".format(
|
||||||
scheme, remote_site
|
scheme, remote_site
|
||||||
)
|
)
|
||||||
site_info_url = "{}://{}/api/method/jcloude.api.site.get".format(scheme, remote_site)
|
site_info_url = "{}://{}/api/action/jcloude.api.site.get".format(scheme, remote_site)
|
||||||
account_details_url = "{}://{}/api/method/jcloude.api.account.get".format(
|
account_details_url = "{}://{}/api/action/jcloude.api.account.get".format(
|
||||||
scheme, remote_site
|
scheme, remote_site
|
||||||
)
|
)
|
||||||
all_site_url = "{}://{}/api/method/jcloude.api.site.all".format(scheme, remote_site)
|
all_site_url = "{}://{}/api/action/jcloude.api.site.all".format(scheme, remote_site)
|
||||||
restore_site_url = "{}://{}/api/method/jcloude.api.site.restore".format(
|
restore_site_url = "{}://{}/api/action/jcloude.api.site.restore".format(
|
||||||
scheme, remote_site
|
scheme, remote_site
|
||||||
)
|
)
|
||||||
finish_multipart_url = "{}://{}/api/method/jcloude.api.site.multipart_exit".format(
|
finish_multipart_url = "{}://{}/api/action/jcloude.api.site.multipart_exit".format(
|
||||||
scheme, remote_site
|
scheme, remote_site
|
||||||
)
|
)
|
||||||
site_plans_url = "{}://{}/api/method/jcloude.api.site.get_site_plans".format(
|
site_plans_url = "{}://{}/api/action/jcloude.api.site.get_site_plans".format(
|
||||||
scheme, remote_site
|
scheme, remote_site
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@
|
|||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro form(fields, action='') %}
|
{% macro form(fields, action='') %}
|
||||||
<form action="/api/method/{{ action }}" method="POST">
|
<form action="/api/action/{{ action }}" method="POST">
|
||||||
<section class="space-y-4">
|
<section class="space-y-4">
|
||||||
{%- for df in fields -%}
|
{%- for df in fields -%}
|
||||||
<p class="space-y-2">
|
<p class="space-y-2">
|
||||||
|
|||||||
@ -340,7 +340,7 @@ class RemoteJingrowSite:
|
|||||||
|
|
||||||
def _validate_jingrow_site(self):
|
def _validate_jingrow_site(self):
|
||||||
"""Validates if Jingrow Site and sets RemoteBackupRetrieval.site"""
|
"""Validates if Jingrow Site and sets RemoteBackupRetrieval.site"""
|
||||||
res = requests.get(f"{self.user_site}/api/method/jingrow.ping", timeout=(5, 10))
|
res = requests.get(f"{self.user_site}/api/action/jingrow.ping", timeout=(5, 10))
|
||||||
|
|
||||||
if not res.ok:
|
if not res.ok:
|
||||||
jingrow.throw("Invalid Jingrow Site")
|
jingrow.throw("Invalid Jingrow Site")
|
||||||
@ -353,7 +353,7 @@ class RemoteJingrowSite:
|
|||||||
def _validate_user_permissions(self):
|
def _validate_user_permissions(self):
|
||||||
"""Validates user permssions on Jingrow Site and sets RemoteBackupRetrieval.user_sid"""
|
"""Validates user permssions on Jingrow Site and sets RemoteBackupRetrieval.user_sid"""
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{self.site}/api/method/login",
|
f"{self.site}/api/action/login",
|
||||||
data={"usr": self.user_login, "pwd": self.password_login},
|
data={"usr": self.user_login, "pwd": self.password_login},
|
||||||
timeout=(5, 10),
|
timeout=(5, 10),
|
||||||
)
|
)
|
||||||
@ -392,7 +392,7 @@ class RemoteJingrowSite:
|
|||||||
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
||||||
suffix = f"?sid={self.user_sid}" if self.user_sid else ""
|
suffix = f"?sid={self.user_sid}" if self.user_sid else ""
|
||||||
res = requests.get(
|
res = requests.get(
|
||||||
f"{self.site}/api/method/jingrow.utils.backups.fetch_latest_backups{suffix}",
|
f"{self.site}/api/action/jingrow.utils.backups.fetch_latest_backups{suffix}",
|
||||||
headers=headers,
|
headers=headers,
|
||||||
timeout=(5, 10),
|
timeout=(5, 10),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -137,7 +137,7 @@ function initiateRequestForLoginToJingrowCloud() {
|
|||||||
|
|
||||||
function requestLoginToFC(freezing_msg) {
|
function requestLoginToFC(freezing_msg) {
|
||||||
jingrow.request.call({
|
jingrow.request.call({
|
||||||
url: `${jingrow_cloud_base_endpoint}/api/method/jcloude.api.developer.saas.send_verification_code`,
|
url: `${jingrow_cloud_base_endpoint}/api/action/jcloude.api.developer.saas.send_verification_code`,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
args: {
|
args: {
|
||||||
domain: window.location.hostname,
|
domain: window.location.hostname,
|
||||||
@ -198,7 +198,7 @@ function showFCLogindialog(email) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
jingrow.request.call({
|
jingrow.request.call({
|
||||||
url: `${jingrow_cloud_base_endpoint}/api/method/jcloude.api.developer.saas.verify_verification_code`,
|
url: `${jingrow_cloud_base_endpoint}/api/action/jcloude.api.developer.saas.verify_verification_code`,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
args: {
|
args: {
|
||||||
domain: window.location.hostname,
|
domain: window.location.hostname,
|
||||||
@ -211,14 +211,14 @@ function showFCLogindialog(email) {
|
|||||||
if (r.login_token) {
|
if (r.login_token) {
|
||||||
fc_login_dialog.hide();
|
fc_login_dialog.hide();
|
||||||
window.open(
|
window.open(
|
||||||
`${jingrow_cloud_base_endpoint}/api/method/jcloude.api.developer.saas.login_to_fc?token=${r.login_token}`,
|
`${jingrow_cloud_base_endpoint}/api/action/jcloude.api.developer.saas.login_to_fc?token=${r.login_token}`,
|
||||||
'_blank',
|
'_blank',
|
||||||
);
|
);
|
||||||
jingrow.msgprint({
|
jingrow.msgprint({
|
||||||
title: __('Jingrow Cloud Login Successful'),
|
title: __('Jingrow Cloud Login Successful'),
|
||||||
indicator: 'green',
|
indicator: 'green',
|
||||||
message: __(
|
message: __(
|
||||||
`<p>You will be redirected to Jingrow Cloud soon.</p><p>If you haven\'t been redirected, <a href="${jingrow_cloud_base_endpoint}/api/method/jcloude.api.developer.saas.login_to_fc?token=${r.login_token}" target="_blank">Click here to login</a></p>`,
|
`<p>You will be redirected to Jingrow Cloud soon.</p><p>If you haven\'t been redirected, <a href="${jingrow_cloud_base_endpoint}/api/action/jcloude.api.developer.saas.login_to_fc?token=${r.login_token}" target="_blank">Click here to login</a></p>`,
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -24,9 +24,9 @@ class SessionMetadata:
|
|||||||
class OtpLogin:
|
class OtpLogin:
|
||||||
def __init__(self, email: str):
|
def __init__(self, email: str):
|
||||||
self.email = email
|
self.email = email
|
||||||
self.opt_url = "https://jcloud.jingrow.com/api/method/jcloude.api.account.send_otp"
|
self.opt_url = "https://jcloud.jingrow.com/api/action/jcloude.api.account.send_otp"
|
||||||
self.login_url = "https://jcloud.jingrow.com/api/method/jcloude.api.account.verify_otp_and_login"
|
self.login_url = "https://jcloud.jingrow.com/api/action/jcloude.api.account.verify_otp_and_login"
|
||||||
self.me = "https://jcloud.jingrow.com/api/method/jcloude.api.account.get"
|
self.me = "https://jcloud.jingrow.com/api/action/jcloude.api.account.get"
|
||||||
|
|
||||||
def send_otp(self):
|
def send_otp(self):
|
||||||
"""Send otp to the email address"""
|
"""Send otp to the email address"""
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class CloudSession(Session):
|
|||||||
|
|
||||||
def __init__(self, session_id: str):
|
def __init__(self, session_id: str):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.base_url = "https://jcloud.jingrow.com/api/method/"
|
self.base_url = "https://jcloud.jingrow.com/api/action/"
|
||||||
self.cookies.set("sid", session_id)
|
self.cookies.set("sid", session_id)
|
||||||
|
|
||||||
def request(self, method, url, *args, **kwargs) -> dict[str, str]:
|
def request(self, method, url, *args, **kwargs) -> dict[str, str]:
|
||||||
|
|||||||
@ -350,7 +350,7 @@ def _build_method_url(session: "CloudSession", method: str) -> str:
|
|||||||
base_url = session.base_url.rstrip("/")
|
base_url = session.base_url.rstrip("/")
|
||||||
if base_url.endswith("/api/method"):
|
if base_url.endswith("/api/method"):
|
||||||
base_url = base_url[: -len("/api/method")]
|
base_url = base_url[: -len("/api/method")]
|
||||||
return f"{base_url}/api/method/{method}"
|
return f"{base_url}/api/action/{method}"
|
||||||
|
|
||||||
|
|
||||||
def _bench_options_url(session: "CloudSession") -> str:
|
def _bench_options_url(session: "CloudSession") -> str:
|
||||||
|
|||||||
@ -139,7 +139,7 @@ func (s *Session) SendRequestWithContext(ctx context.Context, method string, pay
|
|||||||
req.URL = &url.URL{
|
req.URL = &url.URL{
|
||||||
Scheme: schema,
|
Scheme: schema,
|
||||||
Host: s.Server,
|
Host: s.Server,
|
||||||
Path: fmt.Sprintf("/api/method/%s", method),
|
Path: fmt.Sprintf("/api/action/%s", method),
|
||||||
}
|
}
|
||||||
req.Header = http.Header{
|
req.Header = http.Header{
|
||||||
"Content-Type": {"application/json"},
|
"Content-Type": {"application/json"},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user