Skip to content

Commit ed0d880

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 2640313 + e7b3ecc commit ed0d880

File tree

11 files changed

+44
-4
lines changed

11 files changed

+44
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ db-upgrade:
2121
goose up
2222

2323
db-upgrade-raw:
24-
go run ./cmd/$(project_name)/main.go db-upgrade
24+
go run ./cmd/$(project_name)/main.go db:migrate
2525

2626
run:
2727
go run cmd/$(project_name)/main.go

api/requests.http

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@baseUrl=http://localhost:3000
22
@cloudUrl=https://sms.capcom.me
33
@credentials={{$dotenv CLOUD__CREDENTIALS}}
4+
@mobileToken={{$dotenv MOBILE__TOKEN}}
45
@phone={{$dotenv PHONE}}
56

67
###
@@ -13,7 +14,7 @@ Content-Type: application/json
1314
}
1415

1516
###
16-
POST {{cloudUrl}}/api/3rdparty/v1/message HTTP/1.1
17+
POST {{baseUrl}}/api/3rdparty/v1/message HTTP/1.1
1718
Content-Type: application/json
1819
Authorization: Basic {{credentials}}
1920

@@ -32,11 +33,11 @@ Authorization: Basic {{credentials}}
3233

3334
###
3435
GET {{baseUrl}}/api/mobile/v1/message HTTP/1.1
35-
Authorization: Bearer KuvE4LBXzvy8QO2ZXDDMP
36+
Authorization: Bearer {{mobileToken}}
3637

3738
###
3839
PATCH {{baseUrl}}/api/mobile/v1/message HTTP/1.1
39-
Authorization: Bearer KuvE4LBXzvy8QO2ZXDDMP
40+
Authorization: Bearer {{mobileToken}}
4041
Content-Type: application/json
4142

4243
[

api/swagger.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,12 @@
358358
"79990001234"
359359
]
360360
},
361+
"simNumber": {
362+
"description": "Номер сим-карты",
363+
"type": "integer",
364+
"maximum": 3,
365+
"example": 1
366+
},
361367
"ttl": {
362368
"description": "Время жизни сообщения в секундах",
363369
"type": "integer",

api/swagger.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ definitions:
3333
maxItems: 100
3434
minItems: 1
3535
type: array
36+
simNumber:
37+
description: Номер сим-карты
38+
example: 1
39+
maximum: 3
40+
type: integer
3641
ttl:
3742
description: Время жизни сообщения в секундах
3843
example: 86400
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- +goose Up
2+
-- +goose StatementBegin
3+
ALTER TABLE `messages`
4+
ADD `sim_number` tinyint(1) unsigned;
5+
-- +goose StatementEnd
6+
---
7+
-- +goose Down
8+
-- +goose StatementBegin
9+
ALTER TABLE `messages` DROP `sim_number`;
10+
-- +goose StatementEnd

internal/sms-gateway/models/models.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type Message struct {
4848
Message string `gorm:"not null;type:tinytext"`
4949
State MessageState `gorm:"not null;type:enum('Pending','Sent','Processed','Delivered','Failed');default:Pending;index:idx_messages_device_state"`
5050
ValidUntil *time.Time `gorm:"type:datetime"`
51+
SimNumber *uint8 `gorm:"type:tinyint(1) unsigned"`
5152

5253
Device Device `gorm:"foreignKey:DeviceID;constraint:OnDelete:CASCADE"`
5354
Recipients []MessageRecipient `gorm:"foreignKey:MessageID;constraint:OnDelete:CASCADE"`

internal/sms-gateway/services/messages.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func (s *MessagesService) SelectPending(deviceID string) ([]smsgateway.Message,
6262
Message: v.Message,
6363
TTL: ttl,
6464
PhoneNumbers: s.recipientsToDomain(v.Recipients),
65+
SimNumber: v.SimNumber,
6566
}
6667
}
6768

@@ -128,6 +129,7 @@ func (s *MessagesService) Enqeue(device models.Device, message smsgateway.Messag
128129
ExtID: message.ID,
129130
Message: message.Message,
130131
ValidUntil: validUntil,
132+
SimNumber: message.SimNumber,
131133
Recipients: s.recipientsToModel(message.PhoneNumbers),
132134
}
133135
if msg.ExtID == "" {

pkg/smsgateway/domain.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type Message struct {
1515
ID string `json:"id,omitempty" validate:"omitempty,max=36" example:"PyDmBQZZXYmyxMwED8Fzy"` // Идентификатор
1616
Message string `json:"message" validate:"required,max=256" example:"Hello World!"` // Текст сообщения
1717
TTL *uint64 `json:"ttl,omitempty" validate:"omitempty,min=5" example:"86400"` // Время жизни сообщения в секундах
18+
SimNumber *uint8 `json:"simNumber,omitempty" validate:"omitempty,max=3" example:"1"` // Номер сим-карты
1819
PhoneNumbers []string `json:"phoneNumbers" validate:"required,min=1,max=100,dive,required,min=10" example:"79990001234"` // Получатели
1920
}
2021

web/mkdocs/docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ Android SMS Gateway turns your Android smartphone into an SMS gateway. It's a li
88

99
## Features
1010

11+
- **No registration required:** No registration or email is required to create an account.
1112
- **Send SMS programmatically:** Use our API to send messages directly from your own applications or services.
1213
- **Supports Android 5.0 and above:** The application is compatible with Android 5.0 and later versions.
1314
- **Message status tracking:** Monitor the status of your sent messages in real-time.
1415
- **Starts at boot:** The application starts running as soon as your device boots up.
1516
- **Prevents sleep mode:** Your device won't go to sleep while the application is running, ensuring continuous service.
17+
- **Supports multiple SIM cards:** The application supports multiple SIM cards.
1618

1719
## Ideal For
1820

web/mkdocs/docs/installation.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ You can install app to your device from prebuilt APK or by building from sources
66

77
You need an Android device with Android 5.0 (Lollipop) or above for using the application.
88

9+
### Permissions
10+
11+
To use the application, you need to grant the following permissions:
12+
13+
- **SEND_SMS**: This permission is required to send SMS messages.
14+
- **READ_PHONE_STATE**: This permission is required to select the SIM card. Optional, if you don't want to select the SIM card.
15+
916
## Installation from APK
1017

1118
1. Navigate to the [Releases](https://github.com/capcom6/android-sms-gateway/releases) page.

0 commit comments

Comments
 (0)