Browse Source

[slack] Update slack install link for utilize CORS by default for public APIs

Harshg999 4 years ago
parent
commit
90227c70b2

+ 6 - 0
desktop/core/src/desktop/api_public_urls.py

@@ -18,6 +18,7 @@
 import sys
 import sys
 
 
 from desktop import api_public
 from desktop import api_public
+from desktop.lib.botserver import api as botserver_api
 
 
 if sys.version_info[0] > 2:
 if sys.version_info[0] > 2:
   from django.urls import re_path
   from django.urls import re_path
@@ -72,3 +73,8 @@ urlpatterns += [
       name="api_autocomplete_nested",
       name="api_autocomplete_nested",
   ),
   ),
 ]
 ]
+
+# Slack install API for using CORS by default
+urlpatterns = [
+  re_path(r'^slack/install/?$', botserver_api.generate_slack_install_link, name='botserver.api.slack_install_link'),
+]

+ 0 - 2
desktop/core/src/desktop/lib/botserver/urls.py

@@ -29,6 +29,4 @@ urlpatterns = [
 
 
   re_path(r'^api/channels/get/?$', api.get_channels, name='botserver.api.get_channels'),
   re_path(r'^api/channels/get/?$', api.get_channels, name='botserver.api.get_channels'),
   re_path(r'^api/message/send/?$', api.send_message, name='botserver.api.send_message'),
   re_path(r'^api/message/send/?$', api.send_message, name='botserver.api.send_message'),
-
-  re_path(r'^api/install/?$', api.generate_slack_install_link, name='botserver.api.slack_install_link'),
 ]
 ]

+ 1 - 1
docs/gethue/themes/stack-hue-theme/layouts/partials/home.en.html

@@ -189,7 +189,7 @@
   function check(event) {
   function check(event) {
     event.preventDefault();
     event.preventDefault();
 
 
-    const url = 'https://demo.gethue.com/desktop/slack/api/install/?hostname=' + document.getElementById('hostname').value;
+    const url = 'https://demo.gethue.com/api/slack/install/?hostname=' + document.getElementById('hostname').value;
     fetch(url)
     fetch(url)
       .then(response => response.json())
       .then(response => response.json())
       .then(response => {
       .then(response => {