更新api接口地址
This commit is contained in:
parent
809ea7b086
commit
07133169da
@ -22,7 +22,7 @@ export default async function call(method, args) {
|
||||
|
||||
updateState(this, 'RequestStarted', null);
|
||||
|
||||
const res = await fetch(`/api/method/${method}`, {
|
||||
const res = await fetch(`/api/action/${method}`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(args)
|
||||
|
||||
@ -64,7 +64,7 @@ export default class FileUploader {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
xhr.open('POST', '/api/method/upload_file', true);
|
||||
xhr.open('POST', '/api/action/upload_file', true);
|
||||
xhr.setRequestHeader('Accept', 'application/json');
|
||||
if (window.csrf_token && window.csrf_token !== '{{ csrf_token }}') {
|
||||
xhr.setRequestHeader('X-Jingrow-CSRF-Token', window.csrf_token);
|
||||
|
||||
@ -22,7 +22,7 @@ export default class S3FileUploader {
|
||||
async function getUploadLink() {
|
||||
try {
|
||||
let response = await fetch(
|
||||
`/api/method/jcloud.api.site.get_upload_link?file=${file.name}`
|
||||
`/api/action/jcloud.api.site.get_upload_link?file=${file.name}`
|
||||
);
|
||||
let data = await response.json();
|
||||
return data.message;
|
||||
|
||||
@ -81,7 +81,7 @@ if (window.jcloud_frontend_posthog_host?.includes('https://')) {
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
request({
|
||||
url: '/api/method/jcloud.www.dashboard.get_context_for_dev'
|
||||
url: '/api/action/jcloud.www.dashboard.get_context_for_dev'
|
||||
}).then(values => {
|
||||
for (let key in values) {
|
||||
window[key] = values[key];
|
||||
|
||||
@ -12,7 +12,7 @@ const FAKE_BASE_URL = 'http://fc.tests';
|
||||
|
||||
const restHandlers = [
|
||||
rest.post(
|
||||
FAKE_BASE_URL + '/api/method/jcloud.api.site.features',
|
||||
FAKE_BASE_URL + '/api/action/jcloud.api.site.features',
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json({ message: apps }));
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ SitePlansCards: defineAsyncComponent(() => import('./SitePlansCards.vue')),
|
||||
this.isChangingPlan = true;
|
||||
const plan_name = this.selectedPlan?.name;
|
||||
let request = createResource({
|
||||
url: '/api/method/jcloud.api.client.run_pg_method',
|
||||
url: '/api/action/jcloud.api.client.run_pg_method',
|
||||
params: {
|
||||
dt: 'Site',
|
||||
dn: this.site,
|
||||
|
||||
@ -113,7 +113,7 @@ function payUnpaidInvoices() {
|
||||
let invoice = _unpaidInvoices;
|
||||
if (invoice.stripe_invoice_url && team.pg.payment_mode === 'Card') {
|
||||
window.open(
|
||||
`/api/method/jcloud.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`
|
||||
`/api/action/jcloud.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`
|
||||
);
|
||||
} else {
|
||||
showAddPrepaidCreditsDialog.value = true;
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
v-model="paymentGatewayDetails.url"
|
||||
name="url"
|
||||
type="text"
|
||||
placeholder="https://xyz.com/api/method/<endpoint>"
|
||||
placeholder="https://xyz.com/api/action/<endpoint>"
|
||||
/>
|
||||
<div class="flex gap-4">
|
||||
<FormControl
|
||||
|
||||
@ -186,7 +186,7 @@ export default {
|
||||
async fetchTeams() {
|
||||
try {
|
||||
const response = await jingrowRequest({
|
||||
url: '/api/method/jcloud.api.regional_payments.mpesa.utils.display_mpesa_payment_partners',
|
||||
url: '/api/action/jcloud.api.regional_payments.mpesa.utils.display_mpesa_payment_partners',
|
||||
method: 'GET',
|
||||
});
|
||||
if (Array.isArray(response)) {
|
||||
@ -206,7 +206,7 @@ export default {
|
||||
async fetchTaxPercentage() {
|
||||
try {
|
||||
const taxPercentage = await jingrowRequest({
|
||||
url: '/api/method/jcloud.api.regional_payments.mpesa.utils.get_tax_percentage',
|
||||
url: '/api/action/jcloud.api.regional_payments.mpesa.utils.get_tax_percentage',
|
||||
method: 'GET',
|
||||
params: {
|
||||
payment_partner: this.partnerInput.value,
|
||||
|
||||
@ -172,7 +172,7 @@ method: 'GET',
|
||||
async fetchPartners() {
|
||||
try {
|
||||
const response = await jingrowRequest({
|
||||
url: '/api/method/jcloud.api.regional_payments.mpesa.utils.display_payment_partners',
|
||||
url: '/api/action/jcloud.api.regional_payments.mpesa.utils.display_payment_partners',
|
||||
method: 'GET',
|
||||
});
|
||||
if (Array.isArray(response)) {
|
||||
@ -188,7 +188,7 @@ method: 'GET',
|
||||
async fetchPaymentGateway() {
|
||||
try {
|
||||
const response = await jingrowRequest({
|
||||
url: '/api/method/jcloud.api.regional_payments.mpesa.utils.display_payment_gateway',
|
||||
url: '/api/action/jcloud.api.regional_payments.mpesa.utils.display_payment_gateway',
|
||||
method: 'GET',
|
||||
});
|
||||
if (Array.isArray(response)) {
|
||||
|
||||
@ -365,7 +365,7 @@ url: 'jcloud.api.billing.get_unpaid_invoices',
|
||||
this.$team.pg.payment_mode === 'Card'
|
||||
) {
|
||||
window.open(
|
||||
`/api/method/jcloud.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`,
|
||||
`/api/action/jcloud.api.client.run_pg_method?dt=Invoice&dn=${invoice.name}&method=stripe_payment_url`,
|
||||
);
|
||||
} else {
|
||||
this.showAddPrepaidCreditsDialog = true;
|
||||
|
||||
@ -42,7 +42,7 @@ export async function switchToTeam(team) {
|
||||
let canSwitch = false;
|
||||
try {
|
||||
canSwitch = await jingrowRequest({
|
||||
url: '/api/method/jcloud.api.account.can_switch_to_team',
|
||||
url: '/api/action/jcloud.api.account.can_switch_to_team',
|
||||
params: { team }
|
||||
});
|
||||
} catch (error) {
|
||||
@ -62,7 +62,7 @@ export async function switchToTeam(team) {
|
||||
export async function isLastSite(team) {
|
||||
let count = 0;
|
||||
count = await jingrowRequest({
|
||||
url: '/api/method/jcloud.api.account.get_site_count',
|
||||
url: '/api/action/jcloud.api.account.get_site_count',
|
||||
params: { team }
|
||||
});
|
||||
return Boolean(count === 1);
|
||||
|
||||
@ -79,7 +79,7 @@ getInitialData().then(() => {
|
||||
replaysOnErrorSampleRate: 1.0,
|
||||
beforeSend(event, hint) {
|
||||
const ignoreErrors = [
|
||||
/api\/method\/jcloud.api.client/,
|
||||
/api\/action\/jcloud.api.client/,
|
||||
/dynamically imported module/,
|
||||
/NetworkError when attempting to fetch resource/,
|
||||
/Failed to fetch/,
|
||||
@ -154,7 +154,7 @@ getInitialData().then(() => {
|
||||
function getInitialData() {
|
||||
if (import.meta.env.DEV) {
|
||||
return jingrowRequest({
|
||||
url: '/api/method/jcloud.www.dashboard.get_context_for_dev',
|
||||
url: '/api/action/jcloud.www.dashboard.get_context_for_dev',
|
||||
}).then((values) => Object.assign(window, values));
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
|
||||
@ -66,7 +66,7 @@ export default {
|
||||
async onClick() {
|
||||
toast.promise(
|
||||
jingrowRequest({
|
||||
url: '/api/method/jcloud.api.notifications.mark_all_notifications_as_read',
|
||||
url: '/api/action/jcloud.api.notifications.mark_all_notifications_as_read',
|
||||
}),
|
||||
{
|
||||
success: () => {
|
||||
|
||||
@ -191,7 +191,7 @@ export default {
|
||||
e.stopPropagation();
|
||||
if (row.stripe_invoice_url && row.payment_mode == 'Card') {
|
||||
window.open(
|
||||
`/api/method/jcloud.api.client.run_pg_method?dt=Invoice&dn=${row.name}&method=stripe_payment_url`,
|
||||
`/api/action/jcloud.api.client.run_pg_method?dt=Invoice&dn=${row.name}&method=stripe_payment_url`,
|
||||
);
|
||||
} else {
|
||||
this.showBuyPrepaidCreditsDialog = true;
|
||||
|
||||
@ -26,7 +26,7 @@ export default {
|
||||
this.loading = true;
|
||||
try {
|
||||
const response = await jingrowRequest({
|
||||
url: '/api/method/jcloud.api.regional_payments.mpesa.utils.display_invoices_by_partner',
|
||||
url: '/api/action/jcloud.api.regional_payments.mpesa.utils.display_invoices_by_partner',
|
||||
method: 'GET',
|
||||
});
|
||||
this.invoices = response;
|
||||
|
||||
@ -350,7 +350,7 @@ server {
|
||||
http2_push_preload on;
|
||||
}
|
||||
|
||||
location ~ ^/api/method/jcloud.api.developer.saas.* {
|
||||
location ~ ^/api/action/jcloud.api.developer.saas.* {
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header Access-Control-Allow-Origin "*" always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
|
||||
|
||||
@ -478,7 +478,7 @@ class Agent:
|
||||
"site_backup": {
|
||||
"name": site_backup.name,
|
||||
"snapshot_request_key": site_backup.snapshot_request_key,
|
||||
"snapshot_trigger_url": f"{jcloud_public_base_url}/api/method/jcloud.api.site_backup.create_snapshot",
|
||||
"snapshot_trigger_url": f"{jcloud_public_base_url}/api/action/jcloud.api.site_backup.create_snapshot",
|
||||
},
|
||||
}
|
||||
return self.create_agent_job(
|
||||
|
||||
@ -381,7 +381,7 @@ def send_login_link(email):
|
||||
minutes = 10
|
||||
jingrow.cache().set_value(f"one_time_login_key:{key}", email, expires_in_sec=minutes * 60)
|
||||
|
||||
link = get_url(f"/api/method/jcloud.api.account.login_using_key?key={key}")
|
||||
link = get_url(f"/api/action/jcloud.api.account.login_using_key?key={key}")
|
||||
|
||||
if jingrow.conf.developer_mode:
|
||||
print()
|
||||
|
||||
@ -268,7 +268,7 @@ class RequestGroupByChart(StackedGroupByChart):
|
||||
def setup_search_filters(self):
|
||||
super().setup_search_filters()
|
||||
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 self.resource_type == ResourceType.SITE:
|
||||
self.search = self.search.filter("match_phrase", json__site=self.name)
|
||||
@ -411,8 +411,8 @@ def get_advanced_analytics(name, timezone, duration="7d"):
|
||||
|
||||
def get_more_request_detail_fn_names():
|
||||
return {
|
||||
"/api/method/run_pg_method": get_run_pg_method_methodnames.__name__,
|
||||
"/api/method/jingrow.desk.query_report.run": get_query_report_run_reports.__name__,
|
||||
"/api/action/run_pg_method": get_run_pg_method_methodnames.__name__,
|
||||
"/api/action/jingrow.desk.query_report.run": get_query_report_run_reports.__name__,
|
||||
}
|
||||
|
||||
|
||||
@ -542,7 +542,7 @@ class RunDocMethodMethodNames(RequestGroupByChart):
|
||||
|
||||
def setup_search_filters(self):
|
||||
super().setup_search_filters()
|
||||
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 get_run_pg_method_methodnames(site, agg_type, timezone, timespan, timegrain):
|
||||
@ -557,7 +557,7 @@ class QueryReportRunReports(RequestGroupByChart):
|
||||
def setup_search_filters(self):
|
||||
super().setup_search_filters()
|
||||
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"
|
||||
)
|
||||
|
||||
|
||||
@ -761,7 +761,7 @@ def request_logs(name, timezone, date, sort=None, start=0):
|
||||
{"match_phrase": {"json.site": name}},
|
||||
{"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,
|
||||
|
||||
@ -708,7 +708,7 @@ def generate_stk_push(**kwargs):
|
||||
mpesa_setup = get_mpesa_setup_for_team(partner[0])
|
||||
try:
|
||||
callback_url = (
|
||||
get_request_site_address(True) + "/api/method/jcloud.api.billing.verify_m_pesa_transaction"
|
||||
get_request_site_address(True) + "/api/action/jcloud.api.billing.verify_m_pesa_transaction"
|
||||
)
|
||||
env = "production" if not mpesa_setup.sandbox else "sandbox"
|
||||
# for sandbox, business shortcode is same as till number
|
||||
|
||||
@ -160,7 +160,7 @@ class DeveloperApiHandler:
|
||||
jingrow.db.commit()
|
||||
|
||||
return get_url(
|
||||
f"/api/method/jcloud.api.marketplace.login_via_token?token={token}&team={team}&site={self.app_subscription_pg.site}"
|
||||
f"/api/action/jcloud.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)
|
||||
|
||||
domain = jingrow.db.get_value("Saas App", self.app_subscription_pg.app, "custom_domain")
|
||||
return f"https://{domain}/api/method/jcloud.api.saas.login_via_token?token={token}&team={self.app_subscription_pg.team}"
|
||||
return f"https://{domain}/api/action/jcloud.api.saas.login_via_token?token={token}&team={self.app_subscription_pg.team}"
|
||||
|
||||
def get_trial_expiry(self):
|
||||
return jingrow.db.get_value("Site", self.app_subscription_pg.site, "trial_end_date")
|
||||
|
||||
@ -285,7 +285,7 @@ def event_log():
|
||||
try:
|
||||
host_name = jingrow.db.get_value("Site", site, "host_name") or site
|
||||
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,
|
||||
)
|
||||
except Exception as e:
|
||||
|
||||
@ -1181,7 +1181,7 @@ def get_discount_percent(plan, discount=0.0):
|
||||
if team.jerp_partner and jingrow.get_value("Marketplace App Plan", plan, "partner_discount"):
|
||||
client = get_jingrow_io_connection()
|
||||
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},
|
||||
headers=client.headers,
|
||||
)
|
||||
|
||||
@ -1099,7 +1099,7 @@ def get(name):
|
||||
site_name = jingrow.db.get_value("Site Domain", name, "site")
|
||||
if site_name:
|
||||
jingrow.local.response["type"] = "redirect"
|
||||
jingrow.local.response["location"] = f"/api/method/jcloud.api.site.get?name={site_name}"
|
||||
jingrow.local.response["location"] = f"/api/action/jcloud.api.site.get?name={site_name}"
|
||||
return None
|
||||
raise
|
||||
rg_info = jingrow.db.get_value("Release Group", site.group, ["team", "version", "public"], as_dict=True)
|
||||
|
||||
@ -12,48 +12,48 @@ JCLOUD_AUTH_MAX_ENTRIES = 1000000
|
||||
|
||||
|
||||
ALLOWED_PATHS = [
|
||||
"/api/method/create-site-migration",
|
||||
"/api/method/create-version-upgrade",
|
||||
"/api/method/migrate-to-private-bench",
|
||||
"/api/method/find-my-sites",
|
||||
"/api/method/jingrow.core.pagetype.communication.email.mark_email_as_seen",
|
||||
"/api/method/jingrow.realtime.get_user_info",
|
||||
"/api/method/jingrow.realtime.can_subscribe_pg",
|
||||
"/api/method/jingrow.realtime.can_subscribe_pagetype",
|
||||
"/api/method/jingrow.realtime.has_permission",
|
||||
"/api/method/jingrow.www.login.login_via_jingrow",
|
||||
"/api/method/jingrow.integrations.oauth2.authorize",
|
||||
"/api/method/jingrow.integrations.oauth2.approve",
|
||||
"/api/method/jingrow.integrations.oauth2.get_token",
|
||||
"/api/method/jingrow.integrations.oauth2.openid_profile",
|
||||
"/api/method/jingrow.integrations.oauth2_logins.login_via_jingrow",
|
||||
"/api/method/jingrow.website.pagetype.web_page_view.web_page_view.make_view_log",
|
||||
"/api/method/get-user-sites-list-for-new-ticket",
|
||||
"/api/method/ping",
|
||||
"/api/method/login",
|
||||
"/api/method/logout",
|
||||
"/api/method/jcloud.jcloud.pagetype.razorpay_webhook_log.razorpay_webhook_log.razorpay_webhook_handler",
|
||||
"/api/method/jcloud.jcloud.pagetype.razorpay_webhook_log.razorpay_webhook_log.razorpay_authorized_payment_handler",
|
||||
"/api/method/jcloud.jcloud.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler",
|
||||
"/api/method/upload_file",
|
||||
"/api/method/jingrow.search.web_search",
|
||||
"/api/method/jingrow.email.queue.unsubscribe",
|
||||
"/api/method/jcloud.utils.telemetry.capture_read_event",
|
||||
"/api/method/validate_plan_change",
|
||||
"/api/method/marketplace-apps",
|
||||
"/api/method/jcloud.www.dashboard.get_context_for_dev",
|
||||
"/api/method/jingrow.website.pagetype.web_form.web_form.accept",
|
||||
"/api/method/jingrow.core.pagetype.user.user.test_password_strength",
|
||||
"/api/method/jingrow.core.pagetype.user.user.update_password",
|
||||
"/api/method/get_central_migration_data",
|
||||
"/api/action/create-site-migration",
|
||||
"/api/action/create-version-upgrade",
|
||||
"/api/action/migrate-to-private-bench",
|
||||
"/api/action/find-my-sites",
|
||||
"/api/action/jingrow.core.pagetype.communication.email.mark_email_as_seen",
|
||||
"/api/action/jingrow.realtime.get_user_info",
|
||||
"/api/action/jingrow.realtime.can_subscribe_pg",
|
||||
"/api/action/jingrow.realtime.can_subscribe_pagetype",
|
||||
"/api/action/jingrow.realtime.has_permission",
|
||||
"/api/action/jingrow.www.login.login_via_jingrow",
|
||||
"/api/action/jingrow.integrations.oauth2.authorize",
|
||||
"/api/action/jingrow.integrations.oauth2.approve",
|
||||
"/api/action/jingrow.integrations.oauth2.get_token",
|
||||
"/api/action/jingrow.integrations.oauth2.openid_profile",
|
||||
"/api/action/jingrow.integrations.oauth2_logins.login_via_jingrow",
|
||||
"/api/action/jingrow.website.pagetype.web_page_view.web_page_view.make_view_log",
|
||||
"/api/action/get-user-sites-list-for-new-ticket",
|
||||
"/api/action/ping",
|
||||
"/api/action/login",
|
||||
"/api/action/logout",
|
||||
"/api/action/jcloud.jcloud.pagetype.razorpay_webhook_log.razorpay_webhook_log.razorpay_webhook_handler",
|
||||
"/api/action/jcloud.jcloud.pagetype.razorpay_webhook_log.razorpay_webhook_log.razorpay_authorized_payment_handler",
|
||||
"/api/action/jcloud.jcloud.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler",
|
||||
"/api/action/upload_file",
|
||||
"/api/action/jingrow.search.web_search",
|
||||
"/api/action/jingrow.email.queue.unsubscribe",
|
||||
"/api/action/jcloud.utils.telemetry.capture_read_event",
|
||||
"/api/action/validate_plan_change",
|
||||
"/api/action/marketplace-apps",
|
||||
"/api/action/jcloud.www.dashboard.get_context_for_dev",
|
||||
"/api/action/jingrow.website.pagetype.web_form.web_form.accept",
|
||||
"/api/action/jingrow.core.pagetype.user.user.test_password_strength",
|
||||
"/api/action/jingrow.core.pagetype.user.user.update_password",
|
||||
"/api/action/get_central_migration_data",
|
||||
]
|
||||
|
||||
ALLOWED_WILDCARD_PATHS = [
|
||||
"/api/method/jcloud.api.",
|
||||
"/api/method/jcloud.saas.",
|
||||
"/api/method/wiki.",
|
||||
"/api/method/jingrow.integrations.oauth2_logins.",
|
||||
"/api/method/jcloud.www.marketplace.index.",
|
||||
"/api/action/jcloud.api.",
|
||||
"/api/action/jcloud.saas.",
|
||||
"/api/action/wiki.",
|
||||
"/api/action/jingrow.integrations.oauth2_logins.",
|
||||
"/api/action/jcloud.www.marketplace.index.",
|
||||
]
|
||||
|
||||
DENIED_PATHS = [
|
||||
@ -70,7 +70,7 @@ DENIED_WILDCARD_PATHS = [
|
||||
|
||||
def hook(): # noqa: C901
|
||||
if jingrow.form_dict.cmd:
|
||||
path = f"/api/method/{jingrow.form_dict.cmd}"
|
||||
path = f"/api/action/{jingrow.form_dict.cmd}"
|
||||
else:
|
||||
path = jingrow.request.path
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ def start_ngrok_and_set_webhook(context):
|
||||
print(f"Inspect logs at {tunnel.api_url}")
|
||||
|
||||
stripe = get_stripe()
|
||||
url = f"{public_url}/api/method/jcloud.jcloud.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler"
|
||||
url = f"{public_url}/api/action/jcloud.jcloud.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler"
|
||||
stripe.WebhookEndpoint.modify(
|
||||
jingrow.db.get_single_value("Jcloud 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": "/suspended-site",
|
||||
"target": "/api/method/jcloud.api.handle_suspended_site_redirection",
|
||||
"target": "/api/action/jcloud.api.handle_suspended_site_redirection",
|
||||
},
|
||||
{"source": "/f-login", "target": "/dashboard/f-login"},
|
||||
{"source": "/signup", "target": "/jerp/signup"},
|
||||
|
||||
@ -198,7 +198,7 @@ class AccountRequest(Document):
|
||||
"invited_by": self.invited_by,
|
||||
"link": url,
|
||||
"read_pixel_path": get_url(
|
||||
f"/api/method/jcloud.utils.telemetry.capture_read_event?email={self.email}"
|
||||
f"/api/action/jcloud.utils.telemetry.capture_read_event?email={self.email}"
|
||||
),
|
||||
"otp": self.otp,
|
||||
}
|
||||
@ -225,7 +225,7 @@ class AccountRequest(Document):
|
||||
|
||||
def get_verification_url(self):
|
||||
if self.saas:
|
||||
return get_url(f"/api/method/jcloud.api.saas.validate_account_request?key={self.request_key}")
|
||||
return get_url(f"/api/action/jcloud.api.saas.validate_account_request?key={self.request_key}")
|
||||
if self.product_trial:
|
||||
return get_url(
|
||||
f"/dashboard/saas/{self.product_trial}/oauth?key={self.request_key}&email={self.email}"
|
||||
|
||||
@ -744,7 +744,7 @@ class Invoice(Document):
|
||||
def get_pdf(self):
|
||||
print_format = self.meta.default_print_format
|
||||
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()
|
||||
@ -766,7 +766,7 @@ class Invoice(Document):
|
||||
return None
|
||||
client = self.get_jingrowio_connection()
|
||||
response = client.session.post(
|
||||
f"{client.url}/api/method/create-fc-invoice",
|
||||
f"{client.url}/api/action/create-fc-invoice",
|
||||
headers=client.headers,
|
||||
data={
|
||||
"team": team.as_json(),
|
||||
@ -819,7 +819,7 @@ class Invoice(Document):
|
||||
"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:
|
||||
r.raise_for_status()
|
||||
@ -917,7 +917,7 @@ class Invoice(Document):
|
||||
"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:
|
||||
r.raise_for_status()
|
||||
@ -1138,7 +1138,7 @@ def create_sales_invoice_on_external_site(transaction_response):
|
||||
|
||||
# Post to the external site's sales invoice creation API
|
||||
response = client.session.post(
|
||||
f"{client.url}/api/method/jingrow.client.insert",
|
||||
f"{client.url}/api/action/jingrow.client.insert",
|
||||
headers=client.headers,
|
||||
json={"pg": data},
|
||||
)
|
||||
|
||||
@ -195,7 +195,7 @@ class JcloudSettings(Document):
|
||||
def create_stripe_webhook(self):
|
||||
stripe = get_stripe()
|
||||
url = jingrow.utils.get_url(
|
||||
"/api/method/jcloud.jcloud.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler"
|
||||
"/api/action/jcloud.jcloud.pagetype.stripe_webhook_log.stripe_webhook_log.stripe_webhook_handler"
|
||||
)
|
||||
webhook = stripe.WebhookEndpoint.create(
|
||||
url=url,
|
||||
@ -226,7 +226,7 @@ class JcloudSettings(Document):
|
||||
return {
|
||||
"name": app_name,
|
||||
"url": "https://jingrow.cloud",
|
||||
"hook_attributes": {"url": get_url("api/method/jcloud.api.github.hook")},
|
||||
"hook_attributes": {"url": get_url("api/action/jcloud.api.github.hook")},
|
||||
"redirect_url": get_url("github/redirect"),
|
||||
"description": "Managed Jingrow Hosting",
|
||||
"public": True,
|
||||
|
||||
@ -101,7 +101,7 @@ class PrometheusAlertRule(Document):
|
||||
{
|
||||
"name": "web.hook",
|
||||
"webhook_configs": [
|
||||
{"url": jingrow.utils.get_url("api/method/jcloud.api.monitoring.alert")}
|
||||
{"url": jingrow.utils.get_url("api/action/jcloud.api.monitoring.alert")}
|
||||
],
|
||||
}
|
||||
],
|
||||
|
||||
@ -453,7 +453,7 @@ class ReleaseGroup(Document, TagHelpers):
|
||||
with suppress(AttributeError, RuntimeError):
|
||||
if (
|
||||
not jingrow.flags.in_test
|
||||
and jingrow.request.path == "/api/method/jcloud.api.bench.change_branch"
|
||||
and jingrow.request.path == "/api/action/jcloud.api.bench.change_branch"
|
||||
):
|
||||
return # Separate validation exists in set_app_source
|
||||
for app in self.apps:
|
||||
@ -819,7 +819,7 @@ class ReleaseGroup(Document, TagHelpers):
|
||||
}
|
||||
).insert()
|
||||
|
||||
link = get_url(f"/api/method/jcloud.api.bench.confirm_bench_transfer?key={key}")
|
||||
link = get_url(f"/api/action/jcloud.api.bench.confirm_bench_transfer?key={key}")
|
||||
|
||||
if jingrow.conf.developer_mode:
|
||||
print(f"Bench transfer link for {team_mail_id}\n{link}\n")
|
||||
|
||||
@ -1394,7 +1394,7 @@ class Site(Document, TagHelpers):
|
||||
}
|
||||
).insert()
|
||||
|
||||
link = get_url(f"/api/method/jcloud.api.site.confirm_site_transfer?key={key}")
|
||||
link = get_url(f"/api/action/jcloud.api.site.confirm_site_transfer?key={key}")
|
||||
|
||||
if jingrow.conf.developer_mode:
|
||||
print(f"\nSite transfer link for {team_mail_id}\n{link}\n")
|
||||
@ -1511,7 +1511,7 @@ class Site(Document, TagHelpers):
|
||||
if user == "Administrator":
|
||||
password = get_decrypted_password("Site", self.name, "admin_password")
|
||||
response = requests.post(
|
||||
f"https://{self.name}/api/method/login",
|
||||
f"https://{self.name}/api/action/login",
|
||||
data={"usr": user, "pwd": password},
|
||||
)
|
||||
sid = response.cookies.get("sid")
|
||||
@ -1678,7 +1678,7 @@ class Site(Document, TagHelpers):
|
||||
"pagetype": "Webhook",
|
||||
"webhook_pagetype": "User",
|
||||
"enabled": 1,
|
||||
"request_url": "https://jingrow.com/api/method/jcloud.api.site_login.sync_product_site_user",
|
||||
"request_url": "https://jingrow.com/api/action/jcloud.api.site_login.sync_product_site_user",
|
||||
"request_method": "POST",
|
||||
"request_structure": "JSON",
|
||||
"webhook_json": """{ "user_info": { "email": "{{pg.email}}", "enabled": "{{pg.enabled}}" } }""",
|
||||
@ -1796,7 +1796,7 @@ class Site(Document, TagHelpers):
|
||||
self.save()
|
||||
|
||||
def ping(self):
|
||||
return requests.get(f"https://{self.name}/api/method/ping")
|
||||
return requests.get(f"https://{self.name}/api/action/ping")
|
||||
|
||||
def _set_configuration(self, config: list[dict]):
|
||||
"""Similar to _update_configuration but will replace full configuration at once
|
||||
|
||||
@ -921,7 +921,7 @@ class Team(Document):
|
||||
# fetch partner level from framework.jingrow.com
|
||||
client = get_jingrow_io_connection()
|
||||
response = client.session.get(
|
||||
f"{client.url}/api/method/get_partner_level",
|
||||
f"{client.url}/api/action/get_partner_level",
|
||||
headers=client.headers,
|
||||
params={"email": self.partner_email},
|
||||
)
|
||||
|
||||
@ -133,7 +133,7 @@ class TeamDeletionRequest(PersonalDataDeletionRequest):
|
||||
|
||||
def generate_url_for_confirmation(self):
|
||||
params = get_signed_params({"team": self.team})
|
||||
api = jingrow.utils.get_url("/api/method/jcloud.api.account.delete_team")
|
||||
api = jingrow.utils.get_url("/api/action/jcloud.api.account.delete_team")
|
||||
url = f"{api}?{params}"
|
||||
|
||||
if jingrow.conf.developer_mode:
|
||||
@ -173,7 +173,7 @@ class TeamDeletionRequest(PersonalDataDeletionRequest):
|
||||
|
||||
client = get_jingrow_io_connection()
|
||||
response = client.session.delete(
|
||||
f"{client.url}/api/method/delete-fc-team",
|
||||
f"{client.url}/api/action/delete-fc-team",
|
||||
data={"team": self.team},
|
||||
headers=client.headers,
|
||||
)
|
||||
|
||||
@ -41,7 +41,7 @@ class TestTeamDeletionRequest(unittest.TestCase):
|
||||
deletion_url = self.team_deletion_request.generate_url_for_confirmation()
|
||||
self.assertTrue(
|
||||
deletion_url.startswith(
|
||||
jingrow.utils.get_url("/api/method/jcloud.api.account.delete_team")
|
||||
jingrow.utils.get_url("/api/action/jcloud.api.account.delete_team")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ class MarketplaceAppSubscription(Document):
|
||||
try:
|
||||
for path in paths:
|
||||
requests.post(
|
||||
f"https://{self.site}/api/method/{path}",
|
||||
f"https://{self.site}/api/action/{path}",
|
||||
data={"app": self.app, "plan": self.plan},
|
||||
)
|
||||
except Exception:
|
||||
|
||||
@ -75,7 +75,7 @@ class PartnerApprovalRequest(Document):
|
||||
jingrow.throw("Failed to create approval request. Please contact support.")
|
||||
customer = jingrow.db.get_value("Team", self.requested_by, "user")
|
||||
|
||||
link = get_url(f"/api/method/jcloud.api.partner.approve_partner_request?key={self.key}")
|
||||
link = get_url(f"/api/action/jcloud.api.partner.approve_partner_request?key={self.key}")
|
||||
|
||||
jingrow.sendmail(
|
||||
subject="Partner Approval Request",
|
||||
|
||||
@ -59,7 +59,7 @@ scrape_configs:
|
||||
target_label: __param_target
|
||||
- source_labels: [__param_target]
|
||||
target_label: instance
|
||||
regex: 'https://(.*)/api/method/ping'
|
||||
regex: 'https://(.*)/api/action/ping'
|
||||
- target_label: __address__
|
||||
replacement: '{{ server }}'
|
||||
file_sd_configs:
|
||||
@ -80,7 +80,7 @@ scrape_configs:
|
||||
target_label: __param_target
|
||||
- source_labels: [__param_target]
|
||||
target_label: instance
|
||||
regex: 'https://(.*)/api/method/ping'
|
||||
regex: 'https://(.*)/api/action/ping'
|
||||
- target_label: __address__
|
||||
replacement: '{{ server }}'
|
||||
file_sd_configs:
|
||||
|
||||
@ -5,11 +5,11 @@ OIDC_ISSUER = "Jingrow"
|
||||
OIDC_SCOPE = "openid email"
|
||||
|
||||
OIDC_AUTHORIZATION_ENDPOINT = (
|
||||
"{{ sentry_oauth_server_url }}/api/method/jingrow.integrations.oauth2.authorize"
|
||||
"{{ sentry_oauth_server_url }}/api/action/jingrow.integrations.oauth2.authorize"
|
||||
)
|
||||
OIDC_TOKEN_ENDPOINT = (
|
||||
"{{ sentry_oauth_server_url }}/api/method/jingrow.integrations.oauth2.get_token"
|
||||
"{{ 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"
|
||||
"{{ 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;
|
||||
}
|
||||
|
||||
const res = await fetch(`/api/method/${method}`, {
|
||||
const res = await fetch(`/api/action/${method}`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(args),
|
||||
|
||||
@ -10,7 +10,7 @@ from html2text import html2text
|
||||
|
||||
def get_remote_script(remote_site):
|
||||
print("Retrieving Site Migrator...")
|
||||
request_url = f"https://{remote_site}/api/method/jcloud.api.script"
|
||||
request_url = f"https://{remote_site}/api/action/jcloud.api.script"
|
||||
request = requests.get(request_url)
|
||||
|
||||
if request.status_code / 100 != 2:
|
||||
|
||||
@ -14,7 +14,7 @@ import requests
|
||||
def jingrowcloud_migrator():
|
||||
print("Retreiving Site Migrator...")
|
||||
remote_site = "jingrow.com"
|
||||
request_url = "https://{}/api/method/jcloud.api.script_2".format(remote_site)
|
||||
request_url = "https://{}/api/action/jcloud.api.script_2".format(remote_site)
|
||||
request = requests.get(request_url)
|
||||
|
||||
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**
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'http://fc.local:8000/api/method/jcloud.saas.api.auth.generate_access_token' \
|
||||
curl --location --request POST 'http://fc.local:8000/api/action/jcloud.saas.api.auth.generate_access_token' \
|
||||
--header 'x-site: oka-hdz-qpj.tanmoy.fc.jingrow.dev' \
|
||||
--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
|
||||
scheme = "https"
|
||||
|
||||
login_url = "{}://{}/api/method/login".format(scheme, remote_site)
|
||||
upload_url = "{}://{}/api/method/jcloud.api.site.new".format(scheme, remote_site)
|
||||
remote_link_url = "{}://{}/api/method/jcloud.api.site.get_upload_link".format(
|
||||
login_url = "{}://{}/api/action/login".format(scheme, remote_site)
|
||||
upload_url = "{}://{}/api/action/jcloud.api.site.new".format(scheme, remote_site)
|
||||
remote_link_url = "{}://{}/api/action/jcloud.api.site.get_upload_link".format(
|
||||
scheme, remote_site
|
||||
)
|
||||
register_remote_url = "{}://{}/api/method/jcloud.api.site.uploaded_backup_info".format(
|
||||
register_remote_url = "{}://{}/api/action/jcloud.api.site.uploaded_backup_info".format(
|
||||
scheme, remote_site
|
||||
)
|
||||
options_url = "{}://{}/api/method/jcloud.api.site.options_for_new".format(
|
||||
options_url = "{}://{}/api/action/jcloud.api.site.options_for_new".format(
|
||||
scheme, remote_site
|
||||
)
|
||||
site_exists_url = "{}://{}/api/method/jcloud.api.site.exists".format(
|
||||
site_exists_url = "{}://{}/api/action/jcloud.api.site.exists".format(
|
||||
scheme, remote_site
|
||||
)
|
||||
site_info_url = "{}://{}/api/method/jcloud.api.site.get".format(scheme, remote_site)
|
||||
account_details_url = "{}://{}/api/method/jcloud.api.account.get".format(
|
||||
site_info_url = "{}://{}/api/action/jcloud.api.site.get".format(scheme, remote_site)
|
||||
account_details_url = "{}://{}/api/action/jcloud.api.account.get".format(
|
||||
scheme, remote_site
|
||||
)
|
||||
all_site_url = "{}://{}/api/method/jcloud.api.site.all".format(scheme, remote_site)
|
||||
restore_site_url = "{}://{}/api/method/jcloud.api.site.restore".format(
|
||||
all_site_url = "{}://{}/api/action/jcloud.api.site.all".format(scheme, remote_site)
|
||||
restore_site_url = "{}://{}/api/action/jcloud.api.site.restore".format(
|
||||
scheme, remote_site
|
||||
)
|
||||
finish_multipart_url = "{}://{}/api/method/jcloud.api.site.multipart_exit".format(
|
||||
finish_multipart_url = "{}://{}/api/action/jcloud.api.site.multipart_exit".format(
|
||||
scheme, remote_site
|
||||
)
|
||||
site_plans_url = "{}://{}/api/method/jcloud.api.site.get_site_plans".format(
|
||||
site_plans_url = "{}://{}/api/action/jcloud.api.site.get_site_plans".format(
|
||||
scheme, remote_site
|
||||
)
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro form(fields, action='') %}
|
||||
<form action="/api/method/{{ action }}" method="POST">
|
||||
<form action="/api/action/{{ action }}" method="POST">
|
||||
<section class="space-y-4">
|
||||
{%- for df in fields -%}
|
||||
<p class="space-y-2">
|
||||
|
||||
@ -342,7 +342,7 @@ class RemoteJingrowSite:
|
||||
|
||||
def _validate_jingrow_site(self):
|
||||
"""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:
|
||||
jingrow.throw("Invalid Jingrow Site")
|
||||
@ -354,7 +354,7 @@ class RemoteJingrowSite:
|
||||
def _validate_user_permissions(self):
|
||||
"""Validates user permssions on Jingrow Site and sets RemoteBackupRetrieval.user_sid"""
|
||||
response = requests.post(
|
||||
f"{self.site}/api/method/login",
|
||||
f"{self.site}/api/action/login",
|
||||
data={"usr": self.user_login, "pwd": self.password_login},
|
||||
timeout=(5, 10),
|
||||
)
|
||||
@ -393,7 +393,7 @@ class RemoteJingrowSite:
|
||||
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
||||
suffix = f"?sid={self.user_sid}" if self.user_sid else ""
|
||||
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,
|
||||
timeout=(5, 10),
|
||||
)
|
||||
|
||||
@ -225,7 +225,7 @@ def get_partner_external_connection(mpesa_setup):
|
||||
api_secret = pg.get_password("api_secret")
|
||||
url = pg.url
|
||||
|
||||
site_name = url.split("/api/method")[0]
|
||||
site_name = url.split("/api/action")[0]
|
||||
# Establish connection
|
||||
jingrow.local._external_conn = JingrowClient(site_name, api_key=api_key, api_secret=api_secret)
|
||||
return jingrow.local._external_conn
|
||||
|
||||
@ -137,7 +137,7 @@ function initiateRequestForLoginToJingrowCloud() {
|
||||
|
||||
function requestLoginToFC(freezing_msg) {
|
||||
jingrow.request.call({
|
||||
url: `${jingrow_cloud_base_endpoint}/api/method/jcloud.api.developer.saas.send_verification_code`,
|
||||
url: `${jingrow_cloud_base_endpoint}/api/action/jcloud.api.developer.saas.send_verification_code`,
|
||||
type: 'POST',
|
||||
args: {
|
||||
domain: window.location.hostname,
|
||||
@ -198,7 +198,7 @@ function showFCLogchinalog(email) {
|
||||
return;
|
||||
}
|
||||
jingrow.request.call({
|
||||
url: `${jingrow_cloud_base_endpoint}/api/method/jcloud.api.developer.saas.verify_verification_code`,
|
||||
url: `${jingrow_cloud_base_endpoint}/api/action/jcloud.api.developer.saas.verify_verification_code`,
|
||||
type: 'POST',
|
||||
args: {
|
||||
domain: window.location.hostname,
|
||||
@ -211,14 +211,14 @@ function showFCLogchinalog(email) {
|
||||
if (r.login_token) {
|
||||
fc_login_dialog.hide();
|
||||
window.open(
|
||||
`${jingrow_cloud_base_endpoint}/api/method/jcloud.api.developer.saas.login_to_fc?token=${r.login_token}`,
|
||||
`${jingrow_cloud_base_endpoint}/api/action/jcloud.api.developer.saas.login_to_fc?token=${r.login_token}`,
|
||||
'_blank',
|
||||
);
|
||||
jingrow.msgprint({
|
||||
title: __('Jingrow Login Successful'),
|
||||
indicator: 'green',
|
||||
message: __(
|
||||
`<p>You will be redirected to Jingrow soon.</p><p>If you haven\'t been redirected, <a href="${jingrow_cloud_base_endpoint}/api/method/jcloud.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 soon.</p><p>If you haven\'t been redirected, <a href="${jingrow_cloud_base_endpoint}/api/action/jcloud.api.developer.saas.login_to_fc?token=${r.login_token}" target="_blank">Click here to login</a></p>`,
|
||||
),
|
||||
});
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user