Rename `DevEnableShare` to `EnableSharing`

This commit is contained in:
Deluan 2023-01-29 20:33:10 -05:00
parent a651d65a5b
commit 68e6115789
14 changed files with 18 additions and 18 deletions

View File

@ -52,6 +52,7 @@ type configOptions struct {
EnableFavourites bool
EnableStarRating bool
EnableUserEditing bool
EnableSharing bool
DefaultTheme string
DefaultLanguage string
DefaultUIVolume int
@ -78,7 +79,6 @@ type configOptions struct {
DevAutoCreateAdminPassword string
DevAutoLoginUsername string
DevActivityPanel bool
DevEnableShare bool
DevSidebarPlaylists bool
DevEnableBufferedScrobble bool
DevShowArtistPage bool
@ -282,7 +282,7 @@ func init() {
viper.SetDefault("devautocreateadminpassword", "")
viper.SetDefault("devautologinusername", "")
viper.SetDefault("devactivitypanel", true)
viper.SetDefault("devenableshare", false)
viper.SetDefault("enablesharing", false)
viper.SetDefault("devenablebufferedscrobble", true)
viper.SetDefault("devsidebarplaylists", true)
viper.SetDefault("devshowartistpage", true)

View File

@ -45,7 +45,7 @@ func (n *Router) routes() http.Handler {
n.R(r, "/playlist", model.Playlist{}, true)
n.R(r, "/transcoding", model.Transcoding{}, conf.Server.EnableTranscodingConfig)
n.R(r, "/radio", model.Radio{}, true)
if conf.Server.DevEnableShare {
if conf.Server.EnableSharing {
n.RX(r, "/share", n.share.NewRepository, true)
}

View File

@ -38,7 +38,7 @@ func (p *Router) routes() http.Handler {
r.Group(func(r chi.Router) {
r.Use(server.URLParamsMiddleware)
r.HandleFunc("/img/{id}", p.handleImages)
if conf.Server.DevEnableShare {
if conf.Server.EnableSharing {
r.HandleFunc("/s/{id}", p.handleStream)
r.HandleFunc("/{id}", p.handleShares)
r.HandleFunc("/", p.handleShares)

View File

@ -56,7 +56,7 @@ func serveIndex(ds model.DataStore, fs fs.FS, shareInfo *model.Share) http.Handl
"losslessFormats": strings.ToUpper(strings.Join(consts.LosslessFormats, ",")),
"devActivityPanel": conf.Server.DevActivityPanel,
"enableUserEditing": conf.Server.EnableUserEditing,
"devEnableShare": conf.Server.DevEnableShare,
"enableSharing": conf.Server.EnableSharing,
"devSidebarPlaylists": conf.Server.DevSidebarPlaylists,
"lastFMEnabled": conf.Server.LastFM.Enabled,
"lastFMApiKey": conf.Server.LastFM.ApiKey,

View File

@ -224,14 +224,14 @@ var _ = Describe("serveIndex", func() {
Expect(config).To(HaveKeyWithValue("enableUserEditing", true))
})
It("sets the devEnableShare", func() {
It("sets the enableSharing", func() {
r := httptest.NewRequest("GET", "/index.html", nil)
w := httptest.NewRecorder()
serveIndex(ds, fs, nil)(w, r)
config := extractAppConfig(w.Body.String())
Expect(config).To(HaveKeyWithValue("devEnableShare", false))
Expect(config).To(HaveKeyWithValue("enableSharing", false))
})
It("sets the defaultDownsamplingFormat", func() {

View File

@ -163,7 +163,7 @@ func (api *Router) routes() http.Handler {
h(r, "getInternetRadioStations", api.GetInternetRadios)
h(r, "updateInternetRadioStation", api.UpdateInternetRadio)
})
if conf.Server.DevEnableShare {
if conf.Server.EnableSharing {
r.Group(func(r chi.Router) {
h(r, "getShares", api.GetShares)
h(r, "createShare", api.CreateShare)

View File

@ -22,7 +22,7 @@ func (api *Router) GetUser(r *http.Request) (*responses.Subsonic, error) {
response.User.StreamRole = true
response.User.ScrobblingEnabled = true
response.User.DownloadRole = conf.Server.EnableDownloads
response.User.ShareRole = conf.Server.DevEnableShare
response.User.ShareRole = conf.Server.EnableSharing
return response, nil
}
@ -38,7 +38,7 @@ func (api *Router) GetUsers(r *http.Request) (*responses.Subsonic, error) {
user.StreamRole = true
user.ScrobblingEnabled = true
user.DownloadRole = conf.Server.EnableDownloads
user.ShareRole = conf.Server.DevEnableShare
user.ShareRole = conf.Server.EnableSharing
response := newResponse()
response.Users = &responses.Users{User: []responses.User{user}}
return response, nil

View File

@ -110,7 +110,7 @@ const Admin = (props) => {
name="radio"
{...(permissions === 'admin' ? radio.admin : radio.all)}
/>,
config.devEnableShare && <Resource name="share" {...share} />,
config.enableSharing && <Resource name="share" {...share} />,
<Resource
name="playlist"
{...playlist}
@ -142,7 +142,7 @@ const Admin = (props) => {
}
const AppWithHotkeys = () => {
if (config.devEnableShare && shareInfo) {
if (config.enableSharing && shareInfo) {
return <SharePlayer />
}
return (

View File

@ -108,7 +108,7 @@ const AlbumActions = ({
>
<PlaylistAddIcon />
</Button>
{config.devEnableShare && (
{config.enableSharing && (
<Button onClick={handleShare} label={translate('ra.action.share')}>
<ShareIcon />
</Button>

View File

@ -81,7 +81,7 @@ const ContextMenu = ({
action: (data, ids) => dispatch(openAddToPlaylist({ selectedIds: ids })),
},
share: {
enabled: config.devEnableShare,
enabled: config.enableSharing,
needData: false,
label: translate('ra.action.share'),
action: (record) => {

View File

@ -44,7 +44,7 @@ export const SongBulkActions = (props) => {
icon={<RiPlayListAddFill />}
className={classes.button}
/>
{config.devEnableShare && (
{config.enableSharing && (
<BatchShareButton {...props} className={classes.button} />
)}
<AddToPlaylistButton {...props} className={classes.button} />

View File

@ -65,7 +65,7 @@ export const SongContextMenu = ({
),
},
share: {
enabled: config.devEnableShare,
enabled: config.enableSharing,
label: translate('ra.action.share'),
action: (record) => {
dispatch(openShareMenu([record.id], 'song', record.title))

View File

@ -20,7 +20,7 @@ const defaultConfig = {
defaultLanguage: '',
defaultUIVolume: 100,
enableUserEditing: true,
devEnableShare: true,
enableSharing: true,
devSidebarPlaylists: true,
lastFMEnabled: true,
lastFMApiKey: '9b94a5515ea66b2da3ec03c12300327e',

View File

@ -139,7 +139,7 @@ const PlaylistActions = ({ className, ids, data, record, ...rest }) => {
>
<RiPlayListAddFill />
</Button>
{config.devEnableShare && (
{config.enableSharing && (
<Button onClick={handleShare} label={translate('ra.action.share')}>
<ShareIcon />
</Button>