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

Commit ae0cc27

Browse files
author
Noah Lee
authored
Replace into MIT License (#528)
* chore: Replace into MIT license * feat: Update license limits to allow infinite members and deployments * chore: Update CONTRIBUTING.md with authorization instructions * chore: Remove license limit checks in middleware_test.go and license_test.go
1 parent 825798d commit ae0cc27

File tree

5 files changed

+32
-94
lines changed

5 files changed

+32
-94
lines changed

Diff for: CONTRIBUTING.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ GITPLOY_GITHUB_CLIENT_SECRET=XXXXXXXXXXXXX
3838
GITPLOY_STORE_SOURCE=file:./sqlite3.db?cache=shared&_fk=1
3939
```
4040

41-
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.
42-
4341
3\. Run the server:
4442

4543
```
@@ -71,3 +69,22 @@ REACT_APP_GITPLOY_SERVER=http://localhost
7169
```
7270
npm start
7371
```
72+
73+
### Authorization
74+
75+
1\. Run with ngrok
76+
77+
Connect to the public host via [ngrok](https://ngrok.com/) to authorize with GitHub OAuth.
78+
79+
```shell
80+
ngrok http 80
81+
```
82+
83+
2\. Configure GitHub OAuth Apps
84+
85+
Configure the Homepage URL and Authorization callback URLs with the public host which generated by ngrok.
86+
87+
3\. Access the index page
88+
89+
Access the index page of server with the browser. You can find the user is created after authorization.
90+

Diff for: LICENSE

+4-43
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,7 @@
1-
Copyright 2021 Gitploy.IO, Inc.
1+
Copyright 2024 Gitploy.io
22

3-
The Gitploy Community Edition is licensed under the Apache License,
4-
Version 2.0 (the "Apache License").
3+
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:
54

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

8-
The source files in this repository are under the Apache License
9-
basically, but some files are under the Gitploy Non-Commercial License.
10-
The header of files indicating which license they are under.
11-
12-
The Gitploy Enterprise Edition is licensed under the Gitploy
13-
Non-Commercial License (the "Non-Commercial License"). A copy of
14-
the Non-Commercial License is provided below.
15-
16-
The BUILDING_OSS file provides
17-
instructions for creating the Community Edition distribution
18-
subject to the terms of the Apache License.
19-
20-
-----------------------------------------------------------------
21-
22-
Gitploy Non-Commercial License
23-
24-
Contributor: Gitploy.IO, Inc.
25-
26-
Source Code: https://github.com/gitploy-io/gitploy
27-
28-
This license lets you use and share this software for free,
29-
under the count of user limit on commercial use. Specifically:
30-
31-
If you follow the rules below, you may do everything with this
32-
software that would otherwise infringe either the contributor's
33-
copyright in it.
34-
35-
1. You must limit use of this software in any manner primarily
36-
intended for commercial advantage or private monetary compensation.
37-
This limit does not apply to use in developing feedback or extensions
38-
that you contribute back to those giving this license.
39-
40-
2. Ensure everyone who gets a copy of this software from you, in
41-
source code, gets the text of this license.
42-
43-
**This software comes as is, without any warranty at all. As far
44-
as the law allows, the contributor will not be liable for any
45-
damages related to this software or this license, for any kind of
46-
legal claim.**
7+
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.

Diff for: internal/server/api/shared/middleware_test.go

-27
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,6 @@ func TestMiddleware_IsLicenseExpired(t *testing.T) {
4242
}
4343
})
4444

45-
t.Run("Return 402 error when the count of member is over the limit.", func(t *testing.T) {
46-
ctrl := gomock.NewController(t)
47-
m := mock.NewMockInteractor(ctrl)
48-
49-
m.
50-
EXPECT().
51-
GetLicense(gomock.Any()).
52-
Return(extent.NewTrialLicense(extent.TrialMemberLimit+1, extent.TrialDeploymentLimit), nil)
53-
54-
gin.SetMode(gin.ReleaseMode)
55-
router := gin.New()
56-
57-
lm := NewMiddleware(m)
58-
router.GET("/repos", lm.IsLicenseExpired(), func(c *gin.Context) {
59-
c.Status(http.StatusOK)
60-
})
61-
62-
req, _ := http.NewRequest("GET", "/repos", nil)
63-
w := httptest.NewRecorder()
64-
65-
router.ServeHTTP(w, req)
66-
67-
if w.Code != http.StatusPaymentRequired {
68-
t.Fatalf("IsLicenseExpired = %v, wanted %v", w.Code, http.StatusPaymentRequired)
69-
}
70-
})
71-
7245
t.Run("Return 200 when the count of member is under the limit.", func(t *testing.T) {
7346
ctrl := gomock.NewController(t)
7447
m := mock.NewMockInteractor(ctrl)

Diff for: model/extent/license.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
package extent
22

3-
import "time"
3+
import (
4+
"math"
5+
"time"
6+
)
47

58
const (
69
TrialMemberLimit = 5
710
TrialDeploymentLimit = 5000
11+
InfiniteMemberLimit = math.MaxInt
12+
InfiniteDeploymentLimit = math.MaxInt
813
)
914

1015
const (
@@ -47,17 +52,17 @@ func NewTrialLicense(memberCnt, deploymentCnt int) *License {
4752
return &License{
4853
Kind: LicenseKindTrial,
4954
MemberCount: memberCnt,
50-
MemberLimit: TrialMemberLimit,
55+
MemberLimit: InfiniteMemberLimit,
5156
DeploymentCount: deploymentCnt,
52-
DeploymentLimit: TrialDeploymentLimit,
57+
DeploymentLimit: InfiniteMemberLimit,
5358
}
5459
}
5560

5661
func NewStandardLicense(memberCnt int, d *SigningData) *License {
5762
return &License{
5863
Kind: LicenseKindStandard,
5964
MemberCount: memberCnt,
60-
MemberLimit: d.MemberLimit,
65+
MemberLimit: InfiniteMemberLimit,
6166
DeploymentCount: -1,
6267
ExpiredAt: d.ExpiredAt,
6368
}

Diff for: model/extent/license_test.go

-18
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,6 @@ func TestLicense_IsOverLimit(t *testing.T) {
1515
}
1616
})
1717

18-
t.Run("Return true when the trial license is over the member limit.", func(t *testing.T) {
19-
l := NewTrialLicense(TrialMemberLimit+1, 0)
20-
21-
expected := true
22-
if finished := l.IsOverLimit(); finished != expected {
23-
t.Fatalf("IsOverLimit = %v, wanted %v", finished, expected)
24-
}
25-
})
26-
27-
t.Run("Return true when the trial license is over the deployment limit.", func(t *testing.T) {
28-
l := NewTrialLicense(5, TrialDeploymentLimit+1)
29-
30-
expected := true
31-
if finished := l.IsOverLimit(); finished != expected {
32-
t.Fatalf("IsOverLimit = %v, wanted %v", finished, expected)
33-
}
34-
})
35-
3618
t.Run("Return false when the trial license is less than or equal to the limit.", func(t *testing.T) {
3719
l := NewTrialLicense(TrialMemberLimit, TrialDeploymentLimit)
3820

0 commit comments

Comments
 (0)