@widgetic/editor 3.10.37 → 3.10.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/editor",
3
- "version": "3.10.37",
3
+ "version": "3.10.38",
4
4
  "scripts": {
5
5
  "start": "webpack --config webpack.config.js --watch --progress",
6
6
  "build": "webpack --config webpack.config.js",
@@ -2,24 +2,26 @@ Service = require '../../../browser/model'
2
2
  Entry = require '../../../browser/model/entry'
3
3
 
4
4
  # SoundCloud config
5
+ widgetic_backend_url = 'https://widgetic.com/wservices/soundcloud/'
5
6
  SC = require('soundcloud')
6
7
  config = {
8
+ api_url: 'https://api.soundcloud.com'
7
9
  # for '/connect' endpoint
8
10
  client_id : 'aed0aa63baf747a83ad0b6b246acddca'
9
- redirect_uri: 'https://widgetic.com/connect/soundcloud',
11
+ # client_secret: '3173e3098379153d42084aba06fe3ec4',
12
+ redirect_uri: widgetic_backend_url + 'connect',
13
+ tracks_url: widgetic_backend_url + 'tracks',
10
14
  # response_type: 'code',
11
- # state: 'encrypted_session_info',
15
+
12
16
  # for '/oauth2/token' endpoint
13
17
  grant_type: 'refresh_token',
14
- # client_secret: '3173e3098379153d42084aba06fe3ec4',
15
- # local options
16
- api_url: 'https://api.soundcloud.com',
17
18
  }
18
19
  SC.initialize(config);
19
- # add local config options used in this class only
20
+
21
+ # add local config options used in this file only
20
22
  SC.client_id = config.client_id
21
- SC.redirect_uri = config.redirect_uri
22
23
  SC.api_url = config.api_url
24
+ SC.tracks_url = config.tracks_url
23
25
  try SC.auth_token = localStorage.getItem 'soundcloudAuthToken'
24
26
  try SC.userId = localStorage.getItem 'soundcloudUserId'
25
27
 
@@ -30,7 +32,7 @@ class SoundCloudService extends Service
30
32
 
31
33
  SCGet: (path) ->
32
34
  url = "#{SC.api_url}" + path
33
- console.log("SCGet path:", path, SC.auth_token)
35
+ # console.log("SCGet path:", path, SC.auth_token)
34
36
  $.ajax(url: url, type: 'GET', dataType: 'json', headers: {'Authorization': 'OAuth ' + SC.auth_token})
35
37
 
36
38
  auth: (interactive) =>
@@ -43,8 +45,7 @@ class SoundCloudService extends Service
43
45
  else @checkAuth()
44
46
 
45
47
  showAuthPopup: ->
46
- # console.log("SC showAuthPopup:", SC.userId)
47
- # @SCGet("/connect?client_id=#{SC.client_id}&redirect_uri=#{SC.redirect_uri}&response_type=code")
48
+ # console.log("SC showAuthPopup:", SC)
48
49
  SC.connect()
49
50
  .then((response) =>
50
51
  # console.log("SC did connect:", response);
@@ -145,13 +146,18 @@ class SoundCloudService extends Service
145
146
  }
146
147
 
147
148
  getURL: (entry, callback) ->
148
- # console.log("getURL", entry.stream_url)
149
+ # old method
149
150
  # callback "#{entry.stream_url}?client_id=#{SC.client_id}"
150
- @SCGet("/tracks/#{entry.id}/stream")
151
- .then((streams) =>
152
- console.log("fetchTrackStreams result:", streams);
153
- callback streams
154
- ).catch (error) =>
155
- console.log 'Fetch Track Streams error: ' + error
151
+
152
+ # new 2021 api track path through widgetic endpoint
153
+ callback "#{SC.tracks_url}?id=#{entry.id}&atoken=#{SC.auth_token}"
154
+
155
+ # new 2021 api get method
156
+ # @SCGet("/tracks/#{entry.id}/streams")
157
+ # .done((streams) =>
158
+ # console.log("fetchTrackStreams result:", streams);
159
+ # # callback streams.http_mp3_128_url
160
+ # ).fail (error) =>
161
+ # console.log 'Fetch Track Streams error: ' + error
156
162
 
157
163
  module.exports = SoundCloudService