File: ServiceConfig.cpp

package info (click to toggle)
audacity 3.2.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 106,704 kB
  • sloc: cpp: 277,038; ansic: 73,623; lisp: 7,761; python: 3,305; sh: 2,715; perl: 821; xml: 275; makefile: 119
file content (74 lines) | stat: -rw-r--r-- 1,768 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*  SPDX-License-Identifier: GPL-2.0-or-later */
/*!********************************************************************

  Audacity: A Digital Audio Editor

  ServiceConfig.cpp

  Dmitry Vedenko

**********************************************************************/
#include "ServiceConfig.h"

namespace cloud::audiocom
{
std::string_view ServiceConfig::GetAPIEndpoint() const
{
   return "https://api.audio.com";
}

std::string_view ServiceConfig::GetOAuthLoginPage() const
{
   static const std::string loginPage =
      std::string("https://audio.com/audacity/link?clientId=") +
      std::string(GetOAuthClientID());

   return loginPage;
}

std::string_view ServiceConfig::GetOAuthClientID() const
{
   return "1741964426607541";
}

std::string_view ServiceConfig::GetOAuthRedirectURL() const
{
   //return "audacity://link";
   return "https://audio.com/auth/sign-in/success";
}

std::string ServiceConfig::GetAPIUrl(std::string_view apiURI) const
{
   return std::string(GetAPIEndpoint()) + std::string(apiURI);
}

std::string ServiceConfig::GetFinishUploadPage(
   std::string_view audioID, std::string_view token) const
{
   return "http://audio.com/audacity/upload?audioId=" + std::string(audioID) +
          "&token=" + std::string(token) +
          "&clientId=" + std::string(GetOAuthClientID());
}

std::chrono::milliseconds ServiceConfig::GetProgressCallbackTimeout() const
{
   return std::chrono::seconds(3);
}

MimeTypesList ServiceConfig::GetPreferredAudioFormats() const
{
   return { "audio/x-wavpack", "audio/x-flac", "audio/x-wav" };
}

MimeType ServiceConfig::GetDownloadMime() const
{
   return "audio/x-wav";
}

const ServiceConfig& GetServiceConfig()
{
   static ServiceConfig config;
   return config;
}

} // namespace cloud::audiocom