@widgetic/editor 3.10.35 → 3.10.39

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.35",
3
+ "version": "3.10.39",
4
4
  "scripts": {
5
5
  "start": "webpack --config webpack.config.js --watch --progress",
6
6
  "build": "webpack --config webpack.config.js",
@@ -30,7 +30,7 @@ export default class UploadService extends EventsMixin(Service) {
30
30
  constructor(user, token) {
31
31
  super();
32
32
  this.user = user.id;
33
- this.maxFilesize = user.premium ? 100 : 25;
33
+ this.maxFilesize = user.premium ? 250 : 100;
34
34
  this.token = token;
35
35
 
36
36
  this.files = [];
@@ -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'
11
+ # client_secret: '3173e3098379153d42084aba06fe3ec4',
9
12
  redirect_uri: 'https://widgetic.com/connect/soundcloud',
10
- response_type: 'code',
11
- state: 'encrypted_session_info',
13
+ tracks_url: widgetic_backend_url + 'tracks/',
14
+ # response_type: 'code',
15
+
12
16
  # for '/oauth2/token' endpoint
13
- grant_type: 'authorization_code',
14
- client_secret: '3173e3098379153d42084aba06fe3ec4',
15
- # local options
16
- api_url: 'https://api.soundcloud.com',
17
+ grant_type: 'refresh_token',
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,6 +32,7 @@ class SoundCloudService extends Service
30
32
 
31
33
  SCGet: (path) ->
32
34
  url = "#{SC.api_url}" + path
35
+ # console.log("SCGet path:", path, SC.auth_token)
33
36
  $.ajax(url: url, type: 'GET', dataType: 'json', headers: {'Authorization': 'OAuth ' + SC.auth_token})
34
37
 
35
38
  auth: (interactive) =>
@@ -42,8 +45,7 @@ class SoundCloudService extends Service
42
45
  else @checkAuth()
43
46
 
44
47
  showAuthPopup: ->
45
- # console.log("SC showAuthPopup:", SC.userId)
46
- # @SCGet("/connect?client_id=#{SC.client_id}&redirect_uri=#{SC.redirect_uri}&response_type=code")
48
+ # console.log("SC showAuthPopup:", SC)
47
49
  SC.connect()
48
50
  .then((response) =>
49
51
  # console.log("SC did connect:", response);
@@ -109,6 +111,8 @@ class SoundCloudService extends Service
109
111
  # console.log("fetchTracks for playlist:", playlistId)
110
112
  # check if a playlist or entire list of tracks of the current user
111
113
  path = if playlistId then "/playlists/#{playlistId}" else "/users/#{SC.userId}/tracks"
114
+ path += "?access=playable"
115
+
112
116
 
113
117
  @SCGet(path)
114
118
  .then((result) =>
@@ -142,13 +146,18 @@ class SoundCloudService extends Service
142
146
  }
143
147
 
144
148
  getURL: (entry, callback) ->
145
- # console.log("getURL", entry.stream_url)
149
+ # old method
146
150
  # callback "#{entry.stream_url}?client_id=#{SC.client_id}"
147
- @SCGet("/tracks/#{entry.id}/streams")
148
- .then((streams) =>
149
- # console.log("fetchTrackStreams result:", streams);
150
- callback streams.http_mp3_128_url
151
- ).catch (error) =>
152
- 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
153
162
 
154
163
  module.exports = SoundCloudService