Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Replace into MIT License #528

Merged
merged 4 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ GITPLOY_GITHUB_CLIENT_SECRET=XXXXXXXXXXXXX
GITPLOY_STORE_SOURCE=file:./sqlite3.db?cache=shared&_fk=1
```

Note that if you want to interact with GitHub in the local environment, you should install tunneling tools such as [ngork](https://ngrok.com/) and expose your local server.

3\. Run the server:

```
Expand Down Expand Up @@ -71,3 +69,22 @@ REACT_APP_GITPLOY_SERVER=http://localhost
```
npm start
```

### Authorization

1\. Run with ngrok

Connect to the public host via [ngrok](https://ngrok.com/) to authorize with GitHub OAuth.

```shell
ngrok http 80
```

2\. Configure GitHub OAuth Apps

Configure the Homepage URL and Authorization callback URLs with the public host which generated by ngrok.

3\. Access the index page

Access the index page of server with the browser. You can find the user is created after authorization.

47 changes: 4 additions & 43 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,46 +1,7 @@
Copyright 2021 Gitploy.IO, Inc.
Copyright 2024 Gitploy.io

The Gitploy Community Edition is licensed under the Apache License,
Version 2.0 (the "Apache License").
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

http://www.apache.org/licenses/LICENSE-2.0
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The source files in this repository are under the Apache License
basically, but some files are under the Gitploy Non-Commercial License.
The header of files indicating which license they are under.

The Gitploy Enterprise Edition is licensed under the Gitploy
Non-Commercial License (the "Non-Commercial License"). A copy of
the Non-Commercial License is provided below.

The BUILDING_OSS file provides
instructions for creating the Community Edition distribution
subject to the terms of the Apache License.

-----------------------------------------------------------------

Gitploy Non-Commercial License

Contributor: Gitploy.IO, Inc.

Source Code: https://github.com/gitploy-io/gitploy

This license lets you use and share this software for free,
under the count of user limit on commercial use. Specifically:

If you follow the rules below, you may do everything with this
software that would otherwise infringe either the contributor's
copyright in it.

1. You must limit use of this software in any manner primarily
intended for commercial advantage or private monetary compensation.
This limit does not apply to use in developing feedback or extensions
that you contribute back to those giving this license.

2. Ensure everyone who gets a copy of this software from you, in
source code, gets the text of this license.

**This software comes as is, without any warranty at all. As far
as the law allows, the contributor will not be liable for any
damages related to this software or this license, for any kind of
legal claim.**
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 changes: 0 additions & 27 deletions internal/server/api/shared/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,6 @@ func TestMiddleware_IsLicenseExpired(t *testing.T) {
}
})

t.Run("Return 402 error when the count of member is over the limit.", func(t *testing.T) {
ctrl := gomock.NewController(t)
m := mock.NewMockInteractor(ctrl)

m.
EXPECT().
GetLicense(gomock.Any()).
Return(extent.NewTrialLicense(extent.TrialMemberLimit+1, extent.TrialDeploymentLimit), nil)

gin.SetMode(gin.ReleaseMode)
router := gin.New()

lm := NewMiddleware(m)
router.GET("/repos", lm.IsLicenseExpired(), func(c *gin.Context) {
c.Status(http.StatusOK)
})

req, _ := http.NewRequest("GET", "/repos", nil)
w := httptest.NewRecorder()

router.ServeHTTP(w, req)

if w.Code != http.StatusPaymentRequired {
t.Fatalf("IsLicenseExpired = %v, wanted %v", w.Code, http.StatusPaymentRequired)
}
})

t.Run("Return 200 when the count of member is under the limit.", func(t *testing.T) {
ctrl := gomock.NewController(t)
m := mock.NewMockInteractor(ctrl)
Expand Down
13 changes: 9 additions & 4 deletions model/extent/license.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package extent

import "time"
import (
"math"
"time"
)

const (
TrialMemberLimit = 5
TrialDeploymentLimit = 5000
InfiniteMemberLimit = math.MaxInt
InfiniteDeploymentLimit = math.MaxInt
)

const (
Expand Down Expand Up @@ -47,17 +52,17 @@ func NewTrialLicense(memberCnt, deploymentCnt int) *License {
return &License{
Kind: LicenseKindTrial,
MemberCount: memberCnt,
MemberLimit: TrialMemberLimit,
MemberLimit: InfiniteMemberLimit,
DeploymentCount: deploymentCnt,
DeploymentLimit: TrialDeploymentLimit,
DeploymentLimit: InfiniteMemberLimit,
}
}

func NewStandardLicense(memberCnt int, d *SigningData) *License {
return &License{
Kind: LicenseKindStandard,
MemberCount: memberCnt,
MemberLimit: d.MemberLimit,
MemberLimit: InfiniteMemberLimit,
DeploymentCount: -1,
ExpiredAt: d.ExpiredAt,
}
Expand Down
18 changes: 0 additions & 18 deletions model/extent/license_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@ func TestLicense_IsOverLimit(t *testing.T) {
}
})

t.Run("Return true when the trial license is over the member limit.", func(t *testing.T) {
l := NewTrialLicense(TrialMemberLimit+1, 0)

expected := true
if finished := l.IsOverLimit(); finished != expected {
t.Fatalf("IsOverLimit = %v, wanted %v", finished, expected)
}
})

t.Run("Return true when the trial license is over the deployment limit.", func(t *testing.T) {
l := NewTrialLicense(5, TrialDeploymentLimit+1)

expected := true
if finished := l.IsOverLimit(); finished != expected {
t.Fatalf("IsOverLimit = %v, wanted %v", finished, expected)
}
})

t.Run("Return false when the trial license is less than or equal to the limit.", func(t *testing.T) {
l := NewTrialLicense(TrialMemberLimit, TrialDeploymentLimit)

Expand Down
Loading