Compare commits
30 Commits
development
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ecb1ce592a | |||
| 819d615ede | |||
| f2947a088e | |||
| 845e0bd5fb | |||
| a78b3c224b | |||
| 7136e45a90 | |||
| 882b45cbbd | |||
| 36ab4ff1ac | |||
| f87ae2f922 | |||
| 3a49732dfb | |||
| da9ac28f22 | |||
| 176047d161 | |||
| 2fa2f86bd6 | |||
| ef066edffc | |||
| dec72b6af1 | |||
| 9ca3ab9fc2 | |||
| afc2737663 | |||
| aacf5de7f1 | |||
| 2f10a5fb80 | |||
| 25fb7e9272 | |||
| b39ba30dc5 | |||
| 14c218092b | |||
| 833c8ca41a | |||
| c7551854ac | |||
| 27990652d0 | |||
| 351f1fc7f8 | |||
| 1d5683ceda | |||
| f2cf0dfd24 | |||
| 3a1a201eb2 | |||
| 452d4795ed |
@@ -1,110 +0,0 @@
|
|||||||
---
|
|
||||||
name: Architecture Decision Record (ADR)
|
|
||||||
about: Propose or document an architectural decision
|
|
||||||
title: '[ADR] '
|
|
||||||
labels: 'architecture, decision'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## ADR Number
|
|
||||||
ADR-XXXX
|
|
||||||
|
|
||||||
## Status
|
|
||||||
- [ ] Proposed
|
|
||||||
- [ ] Accepted
|
|
||||||
- [ ] Deprecated
|
|
||||||
- [ ] Superseded by ADR-XXXX
|
|
||||||
|
|
||||||
## Context
|
|
||||||
Describe the issue or problem that motivates this decision.
|
|
||||||
|
|
||||||
## Decision
|
|
||||||
State the architecture decision and provide rationale.
|
|
||||||
|
|
||||||
## Consequences
|
|
||||||
### Positive
|
|
||||||
- List positive consequences
|
|
||||||
|
|
||||||
### Negative
|
|
||||||
- List negative consequences or trade-offs
|
|
||||||
|
|
||||||
### Neutral
|
|
||||||
- List neutral aspects
|
|
||||||
|
|
||||||
## Alternatives Considered
|
|
||||||
### Alternative 1
|
|
||||||
- Description
|
|
||||||
- Pros
|
|
||||||
- Cons
|
|
||||||
- Why not chosen
|
|
||||||
|
|
||||||
### Alternative 2
|
|
||||||
- Description
|
|
||||||
- Pros
|
|
||||||
- Cons
|
|
||||||
- Why not chosen
|
|
||||||
|
|
||||||
## Implementation Plan
|
|
||||||
1. Step 1
|
|
||||||
2. Step 2
|
|
||||||
3. Step 3
|
|
||||||
|
|
||||||
## Stakeholders
|
|
||||||
- **Decision Makers**: @user1, @user2
|
|
||||||
- **Consulted**: @user3, @user4
|
|
||||||
- **Informed**: team-name
|
|
||||||
|
|
||||||
## Technical Details
|
|
||||||
### Architecture Diagram
|
|
||||||
```
|
|
||||||
[Add diagram or link]
|
|
||||||
```
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
- Dependency 1
|
|
||||||
- Dependency 2
|
|
||||||
|
|
||||||
### Impact Analysis
|
|
||||||
- **Performance**: [Impact description]
|
|
||||||
- **Security**: [Impact description]
|
|
||||||
- **Scalability**: [Impact description]
|
|
||||||
- **Maintainability**: [Impact description]
|
|
||||||
|
|
||||||
## Testing Strategy
|
|
||||||
- [ ] Unit tests
|
|
||||||
- [ ] Integration tests
|
|
||||||
- [ ] Performance tests
|
|
||||||
- [ ] Security tests
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
- [ ] Architecture documentation updated
|
|
||||||
- [ ] API documentation updated
|
|
||||||
- [ ] Developer guide updated
|
|
||||||
- [ ] Runbook created
|
|
||||||
|
|
||||||
## Migration Path
|
|
||||||
Describe how to migrate from current state to new architecture.
|
|
||||||
|
|
||||||
## Rollback Plan
|
|
||||||
Describe how to rollback if issues occur.
|
|
||||||
|
|
||||||
## Timeline
|
|
||||||
- **Proposal Date**:
|
|
||||||
- **Decision Date**:
|
|
||||||
- **Implementation Start**:
|
|
||||||
- **Expected Completion**:
|
|
||||||
|
|
||||||
## References
|
|
||||||
- Related ADRs:
|
|
||||||
- External resources:
|
|
||||||
- RFCs:
|
|
||||||
|
|
||||||
## Review Checklist
|
|
||||||
- [ ] Aligns with enterprise architecture principles
|
|
||||||
- [ ] Security implications reviewed
|
|
||||||
- [ ] Performance implications reviewed
|
|
||||||
- [ ] Cost implications reviewed
|
|
||||||
- [ ] Compliance requirements met
|
|
||||||
- [ ] Team consensus achieved
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug Report
|
|
||||||
about: Report a bug or issue with the project
|
|
||||||
title: '[BUG] '
|
|
||||||
labels: 'bug'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## Bug Description
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
## Steps to Reproduce
|
|
||||||
1. Go to '...'
|
|
||||||
2. Click on '...'
|
|
||||||
3. Scroll down to '...'
|
|
||||||
4. See error
|
|
||||||
|
|
||||||
## Expected Behavior
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
## Actual Behavior
|
|
||||||
A clear and concise description of what actually happened.
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
If applicable, add screenshots to help explain your problem.
|
|
||||||
|
|
||||||
## Environment
|
|
||||||
- **Project**: [e.g., MokoDoliTools, moko-cassiopeia]
|
|
||||||
- **Version**: [e.g., 1.2.3]
|
|
||||||
- **Platform**: [e.g., Dolibarr 18.0, Joomla 5.0]
|
|
||||||
- **PHP Version**: [e.g., 8.1]
|
|
||||||
- **Database**: [e.g., MySQL 8.0, PostgreSQL 14]
|
|
||||||
- **Browser** (if applicable): [e.g., Chrome 120, Firefox 121]
|
|
||||||
- **OS**: [e.g., Ubuntu 22.04, Windows 11]
|
|
||||||
|
|
||||||
## Additional Context
|
|
||||||
Add any other context about the problem here.
|
|
||||||
|
|
||||||
## Possible Solution
|
|
||||||
If you have suggestions on how to fix the issue, please describe them here.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] I have searched for similar issues before creating this one
|
|
||||||
- [ ] I have provided all the requested information
|
|
||||||
- [ ] I have tested this on the latest stable version
|
|
||||||
- [ ] I have checked the documentation and couldn't find a solution
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
blank_issues_enabled: true
|
|
||||||
contact_links:
|
|
||||||
- name: 💼 Enterprise Support
|
|
||||||
url: https://mokoconsulting.tech/enterprise
|
|
||||||
about: Enterprise-level support and consultation services
|
|
||||||
- name: 💬 Ask a Question
|
|
||||||
url: https://mokoconsulting.tech/
|
|
||||||
about: Get help or ask questions through our website
|
|
||||||
- name: 📚 MokoStandards Documentation
|
|
||||||
url: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
|
||||||
about: View our coding standards and best practices
|
|
||||||
- name: 🔒 Report a Security Vulnerability
|
|
||||||
url: https://git.mokoconsulting.tech/mokoconsulting-tech/.github-private/security/advisories/new
|
|
||||||
about: Report security vulnerabilities privately (for critical issues)
|
|
||||||
- name: 💡 Community Discussions
|
|
||||||
url: https://github.com/orgs/mokoconsulting-tech/discussions
|
|
||||||
about: Join community discussions and Q&A
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
---
|
|
||||||
name: Documentation Issue
|
|
||||||
about: Report an issue with documentation
|
|
||||||
title: '[DOCS] '
|
|
||||||
labels: 'documentation'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation Issue
|
|
||||||
|
|
||||||
**Location**:
|
|
||||||
<!-- Specify the file, page, or section with the issue -->
|
|
||||||
|
|
||||||
## Issue Type
|
|
||||||
<!-- Mark the relevant option with an "x" -->
|
|
||||||
- [ ] Typo or grammar error
|
|
||||||
- [ ] Outdated information
|
|
||||||
- [ ] Missing documentation
|
|
||||||
- [ ] Unclear explanation
|
|
||||||
- [ ] Broken links
|
|
||||||
- [ ] Missing examples
|
|
||||||
- [ ] Other (specify below)
|
|
||||||
|
|
||||||
## Description
|
|
||||||
<!-- Clearly describe the documentation issue -->
|
|
||||||
|
|
||||||
## Current Content
|
|
||||||
<!-- Quote or describe the current documentation (if applicable) -->
|
|
||||||
```
|
|
||||||
Current text here
|
|
||||||
```
|
|
||||||
|
|
||||||
## Suggested Improvement
|
|
||||||
<!-- Provide your suggestion for how to improve the documentation -->
|
|
||||||
```
|
|
||||||
Suggested text here
|
|
||||||
```
|
|
||||||
|
|
||||||
## Additional Context
|
|
||||||
<!-- Add any other context, screenshots, or references -->
|
|
||||||
|
|
||||||
## Standards Alignment
|
|
||||||
- [ ] Follows MokoStandards documentation guidelines
|
|
||||||
- [ ] Uses en_US/en_GB localization
|
|
||||||
- [ ] Includes proper SPDX headers where applicable
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] I have searched for similar documentation issues
|
|
||||||
- [ ] I have provided a clear description
|
|
||||||
- [ ] I have suggested an improvement (if applicable)
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature Request
|
|
||||||
about: Suggest a new feature or enhancement
|
|
||||||
title: '[FEATURE] '
|
|
||||||
labels: 'enhancement'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## Feature Description
|
|
||||||
A clear and concise description of the feature you'd like to see.
|
|
||||||
|
|
||||||
## Problem or Use Case
|
|
||||||
Describe the problem this feature would solve or the use case it addresses.
|
|
||||||
Ex. I'm always frustrated when [...]
|
|
||||||
|
|
||||||
## Proposed Solution
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
## Alternative Solutions
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
## Benefits
|
|
||||||
Describe how this feature would benefit users:
|
|
||||||
- Who would use this feature?
|
|
||||||
- What problems does it solve?
|
|
||||||
- What value does it add?
|
|
||||||
|
|
||||||
## Implementation Details (Optional)
|
|
||||||
If you have ideas about how this could be implemented, share them here:
|
|
||||||
- Technical approach
|
|
||||||
- Files/components that might need changes
|
|
||||||
- Any concerns or challenges you foresee
|
|
||||||
|
|
||||||
## Additional Context
|
|
||||||
Add any other context, mockups, or screenshots about the feature request here.
|
|
||||||
|
|
||||||
## Relevant Standards
|
|
||||||
Does this relate to any standards in [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoStandards)?
|
|
||||||
- [ ] Accessibility (WCAG 2.1 AA)
|
|
||||||
- [ ] Localization (en_US/en_GB)
|
|
||||||
- [ ] Security best practices
|
|
||||||
- [ ] Code quality standards
|
|
||||||
- [ ] Other: [specify]
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] I have searched for similar feature requests before creating this one
|
|
||||||
- [ ] I have clearly described the use case and benefits
|
|
||||||
- [ ] I have considered alternative solutions
|
|
||||||
- [ ] This feature aligns with the project's goals and scope
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
---
|
|
||||||
name: Joomla Extension Issue
|
|
||||||
about: Report an issue with a Joomla extension
|
|
||||||
title: '[JOOMLA] '
|
|
||||||
labels: 'joomla'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## Issue Type
|
|
||||||
- [ ] Component Issue
|
|
||||||
- [ ] Module Issue
|
|
||||||
- [ ] Plugin Issue
|
|
||||||
- [ ] Template Issue
|
|
||||||
|
|
||||||
## Extension Details
|
|
||||||
- **Extension Name**: [e.g., moko-cassiopeia]
|
|
||||||
- **Extension Version**: [e.g., 1.2.3]
|
|
||||||
- **Extension Type**: [Component / Module / Plugin / Template]
|
|
||||||
|
|
||||||
## Joomla Environment
|
|
||||||
- **Joomla Version**: [e.g., 4.4.0, 5.0.0]
|
|
||||||
- **PHP Version**: [e.g., 8.1.0]
|
|
||||||
- **Database**: [MySQL / PostgreSQL / MariaDB]
|
|
||||||
- **Database Version**: [e.g., 8.0]
|
|
||||||
- **Server**: [Apache / Nginx / IIS]
|
|
||||||
- **Hosting**: [Shared / VPS / Dedicated / Cloud]
|
|
||||||
|
|
||||||
## Issue Description
|
|
||||||
Provide a clear and detailed description of the issue.
|
|
||||||
|
|
||||||
## Steps to Reproduce
|
|
||||||
1. Go to '...'
|
|
||||||
2. Click on '...'
|
|
||||||
3. Configure '...'
|
|
||||||
4. See error
|
|
||||||
|
|
||||||
## Expected Behavior
|
|
||||||
What you expected to happen.
|
|
||||||
|
|
||||||
## Actual Behavior
|
|
||||||
What actually happened.
|
|
||||||
|
|
||||||
## Error Messages
|
|
||||||
```
|
|
||||||
# Paste any error messages from Joomla error logs
|
|
||||||
# Location: administrator/logs/error.php
|
|
||||||
```
|
|
||||||
|
|
||||||
## Browser Console Errors
|
|
||||||
```javascript
|
|
||||||
// Paste any JavaScript console errors (F12 in browser)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
Add screenshots to help explain the issue.
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
```ini
|
|
||||||
# Paste extension configuration (sanitize sensitive data)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Installed Extensions
|
|
||||||
List other installed extensions that might conflict:
|
|
||||||
- Extension 1 (version)
|
|
||||||
- Extension 2 (version)
|
|
||||||
|
|
||||||
## Template Overrides
|
|
||||||
- [ ] Using template overrides
|
|
||||||
- [ ] Custom CSS
|
|
||||||
- [ ] Custom JavaScript
|
|
||||||
|
|
||||||
## Additional Context
|
|
||||||
- **Multilingual Site**: [Yes / No]
|
|
||||||
- **Cache Enabled**: [Yes / No]
|
|
||||||
- **Debug Mode**: [Yes / No]
|
|
||||||
- **SEF URLs**: [Yes / No]
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] I have cleared Joomla cache
|
|
||||||
- [ ] I have disabled other extensions to test for conflicts
|
|
||||||
- [ ] I have checked Joomla error logs
|
|
||||||
- [ ] I have tested with a default Joomla template
|
|
||||||
- [ ] I have checked browser console for JavaScript errors
|
|
||||||
- [ ] I have searched for similar issues
|
|
||||||
- [ ] I am using a supported Joomla version
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
---
|
|
||||||
name: Question
|
|
||||||
about: Ask a question about usage, features, or best practices
|
|
||||||
title: '[QUESTION] '
|
|
||||||
labels: ['question']
|
|
||||||
assignees: ['jmiller']
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## Question
|
|
||||||
|
|
||||||
**Your question:**
|
|
||||||
|
|
||||||
|
|
||||||
## Context
|
|
||||||
|
|
||||||
**What are you trying to accomplish?**
|
|
||||||
|
|
||||||
|
|
||||||
**What have you already tried?**
|
|
||||||
|
|
||||||
|
|
||||||
**Category**:
|
|
||||||
- [ ] Script usage
|
|
||||||
- [ ] Configuration
|
|
||||||
- [ ] Workflow setup
|
|
||||||
- [ ] Documentation interpretation
|
|
||||||
- [ ] Best practices
|
|
||||||
- [ ] Integration
|
|
||||||
- [ ] Other: __________
|
|
||||||
|
|
||||||
## Environment (if relevant)
|
|
||||||
|
|
||||||
**Your setup**:
|
|
||||||
- Operating System:
|
|
||||||
- Version:
|
|
||||||
|
|
||||||
## What You've Researched
|
|
||||||
|
|
||||||
**Documentation reviewed**:
|
|
||||||
- [ ] README.md
|
|
||||||
- [ ] Project documentation
|
|
||||||
- [ ] Other (specify): __________
|
|
||||||
|
|
||||||
**Similar issues/questions found**:
|
|
||||||
- #
|
|
||||||
- #
|
|
||||||
|
|
||||||
## Expected Outcome
|
|
||||||
|
|
||||||
**What result are you hoping for?**
|
|
||||||
|
|
||||||
|
|
||||||
## Code/Configuration Samples
|
|
||||||
|
|
||||||
**Relevant code or configuration** (if applicable):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Your code here
|
|
||||||
```
|
|
||||||
|
|
||||||
## Additional Context
|
|
||||||
|
|
||||||
**Any other relevant information:**
|
|
||||||
|
|
||||||
|
|
||||||
**Screenshots** (if helpful):
|
|
||||||
|
|
||||||
|
|
||||||
## Urgency
|
|
||||||
|
|
||||||
- [ ] Urgent (blocking work)
|
|
||||||
- [ ] Normal (can work on other things meanwhile)
|
|
||||||
- [ ] Low priority (just curious)
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
- [ ] I have searched existing issues and discussions
|
|
||||||
- [ ] I have reviewed relevant documentation
|
|
||||||
- [ ] I have provided sufficient context
|
|
||||||
- [ ] I have included code/configuration samples if relevant
|
|
||||||
- [ ] This is a genuine question (not a bug report or feature request)
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
---
|
|
||||||
name: Request for Comments (RFC)
|
|
||||||
about: Propose a significant change for community discussion
|
|
||||||
title: '[RFC] '
|
|
||||||
labels: 'rfc, discussion'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## RFC Summary
|
|
||||||
One-paragraph summary of the proposal.
|
|
||||||
|
|
||||||
## Motivation
|
|
||||||
Why are we doing this? What use cases does it support? What is the expected outcome?
|
|
||||||
|
|
||||||
## Detailed Design
|
|
||||||
### Overview
|
|
||||||
Provide a detailed explanation of the proposed change.
|
|
||||||
|
|
||||||
### API Changes (if applicable)
|
|
||||||
```php
|
|
||||||
// Before
|
|
||||||
function oldApi($param1) { }
|
|
||||||
|
|
||||||
// After
|
|
||||||
function newApi($param1, $param2) { }
|
|
||||||
```
|
|
||||||
|
|
||||||
### User Experience Changes
|
|
||||||
Describe how users will interact with this change.
|
|
||||||
|
|
||||||
### Implementation Approach
|
|
||||||
High-level implementation strategy.
|
|
||||||
|
|
||||||
## Drawbacks
|
|
||||||
Why should we *not* do this?
|
|
||||||
|
|
||||||
## Alternatives
|
|
||||||
What other designs have been considered? What is the impact of not doing this?
|
|
||||||
|
|
||||||
### Alternative 1
|
|
||||||
- Description
|
|
||||||
- Trade-offs
|
|
||||||
|
|
||||||
### Alternative 2
|
|
||||||
- Description
|
|
||||||
- Trade-offs
|
|
||||||
|
|
||||||
## Adoption Strategy
|
|
||||||
How will existing users adopt this? Is this a breaking change?
|
|
||||||
|
|
||||||
### Migration Guide
|
|
||||||
```bash
|
|
||||||
# Steps to migrate
|
|
||||||
```
|
|
||||||
|
|
||||||
### Deprecation Timeline
|
|
||||||
- **Announcement**:
|
|
||||||
- **Deprecation**:
|
|
||||||
- **Removal**:
|
|
||||||
|
|
||||||
## Unresolved Questions
|
|
||||||
- Question 1
|
|
||||||
- Question 2
|
|
||||||
|
|
||||||
## Future Possibilities
|
|
||||||
What future work does this enable?
|
|
||||||
|
|
||||||
## Impact Assessment
|
|
||||||
### Performance
|
|
||||||
Expected performance impact.
|
|
||||||
|
|
||||||
### Security
|
|
||||||
Security considerations and implications.
|
|
||||||
|
|
||||||
### Compatibility
|
|
||||||
- **Backward Compatible**: [Yes / No]
|
|
||||||
- **Breaking Changes**: [List]
|
|
||||||
|
|
||||||
### Maintenance
|
|
||||||
Long-term maintenance considerations.
|
|
||||||
|
|
||||||
## Community Input
|
|
||||||
### Stakeholders
|
|
||||||
- [ ] Core team
|
|
||||||
- [ ] Module developers
|
|
||||||
- [ ] End users
|
|
||||||
- [ ] Enterprise customers
|
|
||||||
|
|
||||||
### Feedback Period
|
|
||||||
**Duration**: [e.g., 2 weeks]
|
|
||||||
**Deadline**: [date]
|
|
||||||
|
|
||||||
## Implementation Timeline
|
|
||||||
### Phase 1: Design
|
|
||||||
- [ ] RFC discussion
|
|
||||||
- [ ] Design finalization
|
|
||||||
- [ ] Approval
|
|
||||||
|
|
||||||
### Phase 2: Implementation
|
|
||||||
- [ ] Core implementation
|
|
||||||
- [ ] Tests
|
|
||||||
- [ ] Documentation
|
|
||||||
|
|
||||||
### Phase 3: Release
|
|
||||||
- [ ] Beta release
|
|
||||||
- [ ] Feedback collection
|
|
||||||
- [ ] Stable release
|
|
||||||
|
|
||||||
## Success Metrics
|
|
||||||
How will we measure success?
|
|
||||||
- Metric 1
|
|
||||||
- Metric 2
|
|
||||||
|
|
||||||
## References
|
|
||||||
- Related RFCs:
|
|
||||||
- External documentation:
|
|
||||||
- Prior art:
|
|
||||||
|
|
||||||
## Open Questions for Community
|
|
||||||
1. Question 1?
|
|
||||||
2. Question 2?
|
|
||||||
|
|
||||||
---
|
|
||||||
**Note**: This RFC is open for community discussion. Please provide feedback in the comments below.
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
---
|
|
||||||
name: Security Vulnerability Report
|
|
||||||
about: Report a security vulnerability (use only for non-critical issues)
|
|
||||||
title: '[SECURITY] '
|
|
||||||
labels: 'security'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## ⚠️ IMPORTANT: Private Disclosure Required
|
|
||||||
|
|
||||||
**For critical security vulnerabilities, DO NOT use this template.**
|
|
||||||
Follow the process in [SECURITY.md](../SECURITY.md) for responsible disclosure.
|
|
||||||
|
|
||||||
Use this template only for:
|
|
||||||
- Security improvements
|
|
||||||
- Non-critical security suggestions
|
|
||||||
- Security documentation updates
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Security Issue
|
|
||||||
|
|
||||||
**Severity**:
|
|
||||||
<!-- Low, Medium, or informational only -->
|
|
||||||
|
|
||||||
## Description
|
|
||||||
<!-- Describe the security concern or improvement suggestion -->
|
|
||||||
|
|
||||||
## Affected Components
|
|
||||||
<!-- List the affected files, features, or components -->
|
|
||||||
|
|
||||||
## Suggested Mitigation
|
|
||||||
<!-- Describe how this could be addressed -->
|
|
||||||
|
|
||||||
## Standards Reference
|
|
||||||
Does this relate to security standards in [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoStandards)?
|
|
||||||
- [ ] SPDX license identifiers
|
|
||||||
- [ ] Secret management
|
|
||||||
- [ ] Dependency security
|
|
||||||
- [ ] Access control
|
|
||||||
- [ ] Other: [specify]
|
|
||||||
|
|
||||||
## Additional Context
|
|
||||||
<!-- Add any other context about the security concern -->
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] This is NOT a critical vulnerability requiring private disclosure
|
|
||||||
- [ ] I have reviewed the SECURITY.md policy
|
|
||||||
- [ ] I have provided sufficient detail for evaluation
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
---
|
|
||||||
name: Version Bump
|
|
||||||
about: Request or track a version change
|
|
||||||
title: '[VERSION] '
|
|
||||||
labels: 'version, type: version'
|
|
||||||
assignees: 'jmiller'
|
|
||||||
---
|
|
||||||
|
|
||||||
## Version Change
|
|
||||||
|
|
||||||
**Current version**: <!-- e.g., 01.02.03 -->
|
|
||||||
**Requested version**: <!-- e.g., 01.03.00 -->
|
|
||||||
**Change type**: <!-- patch / minor / major -->
|
|
||||||
|
|
||||||
## Reason
|
|
||||||
|
|
||||||
<!-- Why is this version bump needed? -->
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
- [ ] README.md `VERSION:` field updated
|
|
||||||
- [ ] CHANGELOG.md entry added
|
|
||||||
- [ ] Module descriptor version updated (Dolibarr: `$this->version`, Joomla: `<version>`)
|
|
||||||
- [ ] All file headers will be auto-propagated by `sync-version-on-merge` workflow
|
|
||||||
@@ -1,66 +1,66 @@
|
|||||||
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
#
|
#
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: mokocli.Release
|
# INGROUP: mokocli.Release
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli
|
||||||
# PATH: /.mokogitea/workflows/auto-bump.yml
|
# PATH: /.mokogitea/workflows/auto-bump.yml
|
||||||
# VERSION: 09.02.00
|
# VERSION: 09.02.00
|
||||||
# BRIEF: Auto patch-bump version on every push to dev (skips merge commits)
|
# BRIEF: Auto patch-bump version on every push to dev (skips merge commits)
|
||||||
|
|
||||||
name: "Universal: Auto Version Bump"
|
name: "Universal: Auto Version Bump"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
- rc
|
- rc
|
||||||
- 'feature/**'
|
- 'feature/**'
|
||||||
- 'patch/**'
|
- 'patch/**'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bump:
|
bump:
|
||||||
name: Version Bump
|
name: Version Bump
|
||||||
runs-on: release
|
runs-on: release
|
||||||
if: >-
|
if: >-
|
||||||
!contains(github.event.head_commit.message, '[skip ci]') &&
|
!contains(github.event.head_commit.message, '[skip ci]') &&
|
||||||
!contains(github.event.head_commit.message, '[skip bump]') &&
|
!contains(github.event.head_commit.message, '[skip bump]') &&
|
||||||
!startsWith(github.event.head_commit.message, 'Merge pull request')
|
!startsWith(github.event.head_commit.message, 'Merge pull request')
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Setup mokocli tools
|
- name: Setup mokocli tools
|
||||||
run: |
|
run: |
|
||||||
if ! command -v composer &> /dev/null; then
|
if ! command -v composer &> /dev/null; then
|
||||||
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer >/dev/null 2>&1
|
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
if [ -d "/opt/mokocli/cli" ]; then
|
if [ -d "/opt/mokocli/cli" ]; then
|
||||||
echo "MOKO_CLI=/opt/mokocli/cli" >> "$GITHUB_ENV"
|
echo "MOKO_CLI=/opt/mokocli/cli" >> "$GITHUB_ENV"
|
||||||
else
|
else
|
||||||
git clone --depth 1 --branch main --quiet \
|
git clone --depth 1 --branch main --quiet \
|
||||||
"https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/MokoConsulting/mokocli.git" \
|
"https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/MokoConsulting/mokocli.git" \
|
||||||
/tmp/mokocli
|
/tmp/mokocli
|
||||||
cd /tmp/mokocli && composer install --no-dev --no-interaction --quiet
|
cd /tmp/mokocli && composer install --no-dev --no-interaction --quiet
|
||||||
echo "MOKO_CLI=/tmp/mokocli/cli" >> "$GITHUB_ENV"
|
echo "MOKO_CLI=/tmp/mokocli/cli" >> "$GITHUB_ENV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
run: |
|
run: |
|
||||||
php ${MOKO_CLI}/version_auto_bump.php \
|
php ${MOKO_CLI}/version_auto_bump.php \
|
||||||
--path . --branch "${GITHUB_REF_NAME}" \
|
--path . --branch "${GITHUB_REF_NAME}" \
|
||||||
--token "${{ secrets.MOKOGITEA_TOKEN }}" \
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" \
|
||||||
--repo-url "https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/${{ github.repository }}.git"
|
--repo-url "https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/${{ github.repository }}.git"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ name: "Universal: Build & Release"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, closed]
|
types: [opened, synchronize, closed]
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
@@ -52,7 +52,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
GITEA_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
|
GITEA_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
|
||||||
GITEA_REPO: ${{ vars.GITEA_REPO || github.event.repository.name }}
|
GITEA_REPO: ${{ vars.GITEA_REPO || github.event.repository.name }}
|
||||||
|
|
||||||
@@ -66,6 +66,7 @@ jobs:
|
|||||||
runs-on: release
|
runs-on: release
|
||||||
if: >-
|
if: >-
|
||||||
(github.event.action == 'opened' && github.event.pull_request.merged != true) ||
|
(github.event.action == 'opened' && github.event.pull_request.merged != true) ||
|
||||||
|
(github.event.action == 'synchronize' && github.event.pull_request.merged != true) ||
|
||||||
(github.event_name == 'workflow_dispatch' && inputs.action == 'promote-rc')
|
(github.event_name == 'workflow_dispatch' && inputs.action == 'promote-rc')
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -101,7 +102,7 @@ jobs:
|
|||||||
php ${MOKO_CLI}/branch_rename.php \
|
php ${MOKO_CLI}/branch_rename.php \
|
||||||
--from "${{ github.event.pull_request.head.ref || 'dev' }}" --to rc \
|
--from "${{ github.event.pull_request.head.ref || 'dev' }}" --to rc \
|
||||||
--token "${{ secrets.MOKOGITEA_TOKEN }}" \
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" \
|
||||||
--api-base "${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}" \
|
--api-base "${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}" \
|
||||||
--pr "${{ github.event.pull_request.number }}"
|
--pr "${{ github.event.pull_request.number }}"
|
||||||
|
|
||||||
- name: Checkout rc and configure git
|
- name: Checkout rc and configure git
|
||||||
@@ -120,7 +121,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Update RC release notes from CHANGELOG.md
|
- name: Update RC release notes from CHANGELOG.md
|
||||||
run: |
|
run: |
|
||||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
|
||||||
# Extract [Unreleased] section from changelog
|
# Extract [Unreleased] section from changelog
|
||||||
@@ -268,7 +269,7 @@ jobs:
|
|||||||
!startsWith(steps.platform.outputs.platform, 'joomla')
|
!startsWith(steps.platform.outputs.platform, 'joomla')
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
VERSION="${{ steps.version.outputs.version }}"
|
||||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
SEMVER_TAG="v${VERSION}"
|
SEMVER_TAG="v${VERSION}"
|
||||||
|
|
||||||
@@ -293,7 +294,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Update release notes and promote changelog
|
- name: Update release notes and promote changelog
|
||||||
run: |
|
run: |
|
||||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
|
||||||
# Get the stable release info (version and ID)
|
# Get the stable release info (version and ID)
|
||||||
@@ -362,7 +363,7 @@ jobs:
|
|||||||
VERSION="${{ steps.bump.outputs.version || steps.version.outputs.version }}"
|
VERSION="${{ steps.bump.outputs.version || steps.version.outputs.version }}"
|
||||||
RELEASE_TAG="${{ steps.version.outputs.release_tag }}"
|
RELEASE_TAG="${{ steps.version.outputs.release_tag }}"
|
||||||
GH_REPO="${{ vars.GH_MIRROR_REPO || github.repository }}"
|
GH_REPO="${{ vars.GH_MIRROR_REPO || github.repository }}"
|
||||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
php ${MOKO_CLI}/release_mirror.php \
|
php ${MOKO_CLI}/release_mirror.php \
|
||||||
--version "$VERSION" --tag "$RELEASE_TAG" \
|
--version "$VERSION" --tag "$RELEASE_TAG" \
|
||||||
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "$API_BASE" \
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "$API_BASE" \
|
||||||
@@ -391,7 +392,7 @@ jobs:
|
|||||||
if: steps.version.outputs.skip != 'true'
|
if: steps.version.outputs.skip != 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
|
|
||||||
# Delete rc branch (ephemeral — created by promote-rc)
|
# Delete rc branch (ephemeral — created by promote-rc)
|
||||||
@@ -415,7 +416,7 @@ jobs:
|
|||||||
if: steps.version.outputs.skip != 'true'
|
if: steps.version.outputs.skip != 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
VERSION="${{ steps.bump.outputs.version || steps.version.outputs.version }}"
|
VERSION="${{ steps.bump.outputs.version || steps.version.outputs.version }}"
|
||||||
BRANCH_NAME="version/${VERSION}"
|
BRANCH_NAME="version/${VERSION}"
|
||||||
@@ -436,7 +437,7 @@ jobs:
|
|||||||
if: steps.version.outputs.skip != 'true'
|
if: steps.version.outputs.skip != 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
API_BASE="${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
|
||||||
php ${MOKO_CLI}/version_reset_dev.php \
|
php ${MOKO_CLI}/version_reset_dev.php \
|
||||||
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "${API_BASE}" \
|
--token "${{ secrets.MOKOGITEA_TOKEN }}" --api-base "${API_BASE}" \
|
||||||
--branch dev --path . 2>&1 || true
|
--branch dev --path . 2>&1 || true
|
||||||
@@ -462,5 +463,5 @@ jobs:
|
|||||||
echo "| Version | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY
|
echo "| Version | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "| Branch | \`${{ steps.version.outputs.branch }}\` |" >> $GITHUB_STEP_SUMMARY
|
echo "| Branch | \`${{ steps.version.outputs.branch }}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "| Tag | \`${{ steps.version.outputs.tag }}\` |" >> $GITHUB_STEP_SUMMARY
|
echo "| Tag | \`${{ steps.version.outputs.tag }}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "| Release | [View](${GITEA_URL}/${GITEA_ORG}/${GITEA_REPO}/releases/tag/${{ steps.version.outputs.tag }}) |" >> $GITHUB_STEP_SUMMARY
|
echo "| Release | [View](${MOKOGITEA_URL}/${GITEA_ORG}/${GITEA_REPO}/releases/tag/${{ steps.version.outputs.tag }}) |" >> $GITHUB_STEP_SUMMARY
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -13,6 +13,12 @@
|
|||||||
name: "Generic: Project CI"
|
name: "Generic: Project CI"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
- dev/**
|
||||||
|
- rc/**
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|||||||
@@ -1 +1,68 @@
|
|||||||
IyBDb3B5cmlnaHQgKEMpIDIwMjYgTW9rbyBDb25zdWx0aW5nIDxoZWxsb0Btb2tvY29uc3VsdGluZy50ZWNoPgojCiMgU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEdQTC0zLjAtb3ItbGF0ZXIKIwojIEZJTEUgSU5GT1JNQVRJT04KIyBERUZHUk9VUDogR2l0ZWEuV29ya2Zsb3cKIyBJTkdST1VQOiBtb2tvY2xpLlVuaXZlcnNhbAojIFJFUE86IGh0dHBzOi8vZ2l0Lm1va29jb25zdWx0aW5nLnRlY2gvTW9rb0NvbnN1bHRpbmcvbW9rb2NsaQojIFBBVEg6IC8ubW9rb2dpdGVhL3dvcmtmbG93cy9jaS1pc3N1ZS1yZXBvcnRlci55bWwKIyBWRVJTSU9OOiAwMS4wMC4wMAojIEJSSUVGOiBSZXVzYWJsZSB3b3JrZmxvdyDigJQgY3JlYXRlcy91cGRhdGVzIGEgR2l0ZWEgaXNzdWUgd2hlbiBhIENJIGdhdGUgZmFpbHMuCiMgICAgICAgIENsb25lcyBNb2tvQ0xJIGFuZCBydW5zIGNsaS9jaV9pc3N1ZV9yZXBvcnRlci5zaC4KCm5hbWU6ICJVbml2ZXJzYWw6IENJIElzc3VlIFJlcG9ydGVyIgoKb246CiAgd29ya2Zsb3dfY2FsbDoKICAgIGlucHV0czoKICAgICAgZ2F0ZToKICAgICAgICBkZXNjcmlwdGlvbjogIkNJIGdhdGUgbmFtZSAoZS5nLiBQUiBWYWxpZGF0aW9uLCBSZXBvc2l0b3J5IEhlYWx0aCkiCiAgICAgICAgcmVxdWlyZWQ6IHRydWUKICAgICAgICB0eXBlOiBzdHJpbmcKICAgICAgZGV0YWlsczoKICAgICAgICBkZXNjcmlwdGlvbjogIkh1bWFuLXJlYWRhYmxlIGZhaWx1cmUgZGVzY3JpcHRpb24iCiAgICAgICAgcmVxdWlyZWQ6IHRydWUKICAgICAgICB0eXBlOiBzdHJpbmcKICAgICAgc2V2ZXJpdHk6CiAgICAgICAgZGVzY3JpcHRpb246ICJlcnJvciBvciB3YXJuaW5nIgogICAgICAgIHJlcXVpcmVkOiBmYWxzZQogICAgICAgIHR5cGU6IHN0cmluZwogICAgICAgIGRlZmF1bHQ6ICJlcnJvciIKICAgICAgd29ya2Zsb3c6CiAgICAgICAgZGVzY3JpcHRpb246ICJXb3JrZmxvdyBuYW1lIGZvciB0aGUgaXNzdWUgdGl0bGUiCiAgICAgICAgcmVxdWlyZWQ6IGZhbHNlCiAgICAgICAgdHlwZTogc3RyaW5nCiAgICAgICAgZGVmYXVsdDogIiIKICAgIHNlY3JldHM6CiAgICAgIE1PS09HSVRFQV9UT0tFTjoKICAgICAgICByZXF1aXJlZDogdHJ1ZQoKZW52OgogIEZPUkNFX0pBVkFTQ1JJUFRfQUNUSU9OU19UT19OT0RFMjQ6IHRydWUKCmpvYnM6CiAgcmVwb3J0OgogICAgbmFtZTogIlJlcG9ydDogJHt7IGlucHV0cy5nYXRlIH19IgogICAgcnVucy1vbjogdWJ1bnR1LWxhdGVzdAoKICAgIHN0ZXBzOgogICAgICAtIG5hbWU6IENsb25lIE1va29DTEkKICAgICAgICBlbnY6CiAgICAgICAgICBNT0tPR0lURUFfVE9LRU46ICR7eyBzZWNyZXRzLk1PS09HSVRFQV9UT0tFTiB9fQogICAgICAgIHJ1bjogfAogICAgICAgICAgTU9LT0dJVEVBX1VSTD0iJHt7IHZhcnMuR0lURUFfVVJMIHx8ICdodHRwczovL2dpdC5tb2tvY29uc3VsdGluZy50ZWNoJyB9fSIKICAgICAgICAgIGdpdCBjbG9uZSAtLWRlcHRoIDEgLS1maWx0ZXI9YmxvYjpub25lIC0tc3BhcnNlICIke01PS09HSVRFQV9VUkx9L01va29Db25zdWx0aW5nL01va29DTEkuZ2l0IiAvdG1wL21va29jbGkKICAgICAgICAgIGNkIC90bXAvbW9rb2NsaSAmJiBnaXQgc3BhcnNlLWNoZWNrb3V0IHNldCBjbGkvY2lfaXNzdWVfcmVwb3J0ZXIuc2gKCiAgICAgIC0gbmFtZTogUmVwb3J0IENJIGZhaWx1cmUKICAgICAgICBlbnY6CiAgICAgICAgICBNT0tPR0lURUFfVE9LRU46ICR7eyBzZWNyZXRzLk1PS09HSVRFQV9UT0tFTiB9fQogICAgICAgICAgTU9LT0dJVEVBX1VSTDogJHt7IHZhcnMuR0lURUFfVVJMIHx8ICdodHRwczovL2dpdC5tb2tvY29uc3VsdGluZy50ZWNoJyB9fQogICAgICAgIHJ1bjogfAogICAgICAgICAgY2htb2QgK3ggL3RtcC9tb2tvY2xpL2NsaS9jaV9pc3N1ZV9yZXBvcnRlci5zaAogICAgICAgICAgL3RtcC9tb2tvY2xpL2NsaS9jaV9pc3N1ZV9yZXBvcnRlci5zaCBcCiAgICAgICAgICAgIC0tZ2F0ZSAiJHt7IGlucHV0cy5nYXRlIH19IiBcCiAgICAgICAgICAgIC0tZGV0YWlscyAiJHt7IGlucHV0cy5kZXRhaWxzIH19IiBcCiAgICAgICAgICAgIC0tc2V2ZXJpdHkgIiR7eyBpbnB1dHMuc2V2ZXJpdHkgfX0iIFwKICAgICAgICAgICAgLS13b3JrZmxvdyAiJHt7IGlucHV0cy53b3JrZmxvdyB9fSIK
|
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
|
# FILE INFORMATION
|
||||||
|
# DEFGROUP: Gitea.Workflow
|
||||||
|
# INGROUP: mokocli.Universal
|
||||||
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli
|
||||||
|
# PATH: /.mokogitea/workflows/ci-issue-reporter.yml
|
||||||
|
# VERSION: 01.00.00
|
||||||
|
# BRIEF: Reusable workflow — creates/updates a Gitea issue when a CI gate fails.
|
||||||
|
# Clones MokoCLI and runs cli/ci_issue_reporter.sh.
|
||||||
|
|
||||||
|
name: "Universal: CI Issue Reporter"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
gate:
|
||||||
|
description: "CI gate name (e.g. PR Validation, Repository Health)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
details:
|
||||||
|
description: "Human-readable failure description"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
severity:
|
||||||
|
description: "error or warning"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "error"
|
||||||
|
workflow:
|
||||||
|
description: "Workflow name for the issue title"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
secrets:
|
||||||
|
MOKOGITEA_TOKEN:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
report:
|
||||||
|
name: "Report: ${{ inputs.gate }}"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clone MokoCLI
|
||||||
|
env:
|
||||||
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
run: |
|
||||||
|
MOKOGITEA_URL="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}"
|
||||||
|
git clone --depth 1 --filter=blob:none --sparse "${MOKOGITEA_URL}/MokoConsulting/MokoCLI.git" /tmp/mokocli
|
||||||
|
cd /tmp/mokocli && git sparse-checkout set cli/ci_issue_reporter.sh
|
||||||
|
|
||||||
|
- name: Report CI failure
|
||||||
|
env:
|
||||||
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
run: |
|
||||||
|
chmod +x /tmp/mokocli/cli/ci_issue_reporter.sh
|
||||||
|
/tmp/mokocli/cli/ci_issue_reporter.sh \
|
||||||
|
--gate "${{ inputs.gate }}" \
|
||||||
|
--details "${{ inputs.details }}" \
|
||||||
|
--severity "${{ inputs.severity }}" \
|
||||||
|
--workflow "${{ inputs.workflow }}"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cleanup:
|
cleanup:
|
||||||
@@ -33,17 +33,17 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.GA_TOKEN }}
|
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
|
|
||||||
- name: Delete merged branches
|
- name: Delete merged branches
|
||||||
env:
|
env:
|
||||||
GA_TOKEN: ${{ secrets.GA_TOKEN }}
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
echo "=== Merged Branch Cleanup ==="
|
echo "=== Merged Branch Cleanup ==="
|
||||||
API="${GITEA_URL}/api/v1/repos/${{ github.repository }}"
|
API="${MOKOGITEA_URL}/api/v1/repos/${{ github.repository }}"
|
||||||
|
|
||||||
# List branches via API
|
# List branches via API
|
||||||
BRANCHES=$(curl -sS -H "Authorization: token ${GA_TOKEN}" \
|
BRANCHES=$(curl -sS -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||||
"${API}/branches?limit=50" | jq -r '.[].name')
|
"${API}/branches?limit=50" | jq -r '.[].name')
|
||||||
|
|
||||||
DELETED=0
|
DELETED=0
|
||||||
@@ -56,7 +56,7 @@ jobs:
|
|||||||
# Check if branch is merged into main
|
# Check if branch is merged into main
|
||||||
if git merge-base --is-ancestor "origin/${BRANCH}" origin/main 2>/dev/null; then
|
if git merge-base --is-ancestor "origin/${BRANCH}" origin/main 2>/dev/null; then
|
||||||
echo " Deleting merged branch: ${BRANCH}"
|
echo " Deleting merged branch: ${BRANCH}"
|
||||||
curl -sS -X DELETE -H "Authorization: token ${GA_TOKEN}" \
|
curl -sS -X DELETE -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||||
"${API}/branches/${BRANCH}" 2>/dev/null || true
|
"${API}/branches/${BRANCH}" 2>/dev/null || true
|
||||||
DELETED=$((DELETED + 1))
|
DELETED=$((DELETED + 1))
|
||||||
fi
|
fi
|
||||||
@@ -66,20 +66,20 @@ jobs:
|
|||||||
|
|
||||||
- name: Clean old workflow runs
|
- name: Clean old workflow runs
|
||||||
env:
|
env:
|
||||||
GA_TOKEN: ${{ secrets.GA_TOKEN }}
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
echo "=== Workflow Run Cleanup ==="
|
echo "=== Workflow Run Cleanup ==="
|
||||||
API="${GITEA_URL}/api/v1/repos/${{ github.repository }}"
|
API="${MOKOGITEA_URL}/api/v1/repos/${{ github.repository }}"
|
||||||
CUTOFF=$(date -d "30 days ago" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -v-30d +%Y-%m-%dT%H:%M:%SZ)
|
CUTOFF=$(date -d "30 days ago" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -v-30d +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
|
||||||
# Get old completed runs
|
# Get old completed runs
|
||||||
RUNS=$(curl -sS -H "Authorization: token ${GA_TOKEN}" \
|
RUNS=$(curl -sS -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||||
"${API}/actions/runs?status=completed&limit=50" | \
|
"${API}/actions/runs?status=completed&limit=50" | \
|
||||||
jq -r ".workflow_runs[] | select(.created_at < \"${CUTOFF}\") | .id" 2>/dev/null)
|
jq -r ".workflow_runs[] | select(.created_at < \"${CUTOFF}\") | .id" 2>/dev/null)
|
||||||
|
|
||||||
DELETED=0
|
DELETED=0
|
||||||
for RUN_ID in $RUNS; do
|
for RUN_ID in $RUNS; do
|
||||||
curl -sS -X DELETE -H "Authorization: token ${GA_TOKEN}" \
|
curl -sS -X DELETE -H "Authorization: token ${MOKOGITEA_TOKEN}" \
|
||||||
"${API}/actions/runs/${RUN_ID}" 2>/dev/null || true
|
"${API}/actions/runs/${RUN_ID}" 2>/dev/null || true
|
||||||
DELETED=$((DELETED + 1))
|
DELETED=$((DELETED + 1))
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
|
# FILE INFORMATION
|
||||||
|
# DEFGROUP: Gitea.Workflow
|
||||||
|
# INGROUP: MokoStandards.Deploy
|
||||||
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-API
|
||||||
|
# PATH: /templates/workflows/joomla/deploy-manual.yml.template
|
||||||
|
# VERSION: 04.07.00
|
||||||
|
# BRIEF: Manual SFTP deploy to dev server for Joomla repos
|
||||||
|
|
||||||
|
name: "Universal: Deploy to Dev (Manual)"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
clear_remote:
|
||||||
|
description: 'Delete all remote files before uploading'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: SFTP Deploy to Dev
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
run: |
|
||||||
|
php -v && composer --version
|
||||||
|
|
||||||
|
- name: Setup MokoStandards tools
|
||||||
|
env:
|
||||||
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN || github.token }}
|
||||||
|
MOKO_CLONE_TOKEN: ${{ secrets.MOKOGITEA_TOKEN || github.token }}
|
||||||
|
MOKO_CLONE_HOST: ${{ secrets.MOKOGITEA_TOKEN && 'git.mokoconsulting.tech/MokoConsulting' || 'github.com/mokoconsulting-tech' }}
|
||||||
|
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.MOKOGITEA_TOKEN || github.token }}"}}'
|
||||||
|
run: |
|
||||||
|
git clone --depth 1 --branch main --quiet \
|
||||||
|
"https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoStandards-API.git" \
|
||||||
|
/tmp/mokostandards-api 2>/dev/null || true
|
||||||
|
if [ -d "/tmp/mokostandards-api" ] && [ -f "/tmp/mokostandards-api/composer.json" ]; then
|
||||||
|
cd /tmp/mokostandards-api && composer install --no-dev --no-interaction --quiet 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Check FTP configuration
|
||||||
|
id: check
|
||||||
|
env:
|
||||||
|
HOST: ${{ vars.DEV_FTP_HOST }}
|
||||||
|
PATH_VAR: ${{ vars.DEV_FTP_PATH }}
|
||||||
|
PORT: ${{ vars.DEV_FTP_PORT }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$HOST" ] || [ -z "$PATH_VAR" ]; then
|
||||||
|
echo "DEV_FTP_HOST or DEV_FTP_PATH not configured -- cannot deploy"
|
||||||
|
echo "skip=true" >> "$GITHUB_OUTPUT"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "skip=false" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "host=$HOST" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
REMOTE="${PATH_VAR%/}"
|
||||||
|
echo "remote=$REMOTE" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
[ -z "$PORT" ] && PORT="22"
|
||||||
|
echo "port=$PORT" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Deploy via SFTP
|
||||||
|
if: steps.check.outputs.skip != 'true'
|
||||||
|
env:
|
||||||
|
SFTP_KEY: ${{ secrets.DEV_FTP_KEY }}
|
||||||
|
SFTP_PASS: ${{ secrets.DEV_FTP_PASSWORD }}
|
||||||
|
SFTP_USER: ${{ vars.DEV_FTP_USERNAME }}
|
||||||
|
run: |
|
||||||
|
SOURCE_DIR="src"
|
||||||
|
[ ! -d "$SOURCE_DIR" ] && SOURCE_DIR="htdocs"
|
||||||
|
[ ! -d "$SOURCE_DIR" ] && { echo "No src/ or htdocs/ -- nothing to deploy"; exit 0; }
|
||||||
|
|
||||||
|
printf '{"host":"%s","port":%s,"username":"%s","remotePath":"%s"' \
|
||||||
|
"${{ steps.check.outputs.host }}" "${{ steps.check.outputs.port }}" "$SFTP_USER" "${{ steps.check.outputs.remote }}" \
|
||||||
|
> /tmp/sftp-config.json
|
||||||
|
|
||||||
|
if [ -n "$SFTP_KEY" ]; then
|
||||||
|
echo "$SFTP_KEY" > /tmp/deploy_key
|
||||||
|
chmod 600 /tmp/deploy_key
|
||||||
|
printf ',"privateKeyPath":"/tmp/deploy_key"}' >> /tmp/sftp-config.json
|
||||||
|
else
|
||||||
|
printf ',"password":"%s"}' "$SFTP_PASS" >> /tmp/sftp-config.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEPLOY_ARGS=(--path . --src-dir "$SOURCE_DIR" --config /tmp/sftp-config.json)
|
||||||
|
[ "${{ inputs.clear_remote }}" = "true" ] && DEPLOY_ARGS+=(--clear-remote)
|
||||||
|
|
||||||
|
PLATFORM=$(php /tmp/mokostandards-api/cli/platform_detect.php --path . 2>/dev/null || true)
|
||||||
|
if [ "$PLATFORM" = "waas-component" ] && [ -f "/tmp/mokostandards-api/deploy/deploy-joomla.php" ]; then
|
||||||
|
php /tmp/mokostandards-api/deploy/deploy-joomla.php "${DEPLOY_ARGS[@]}"
|
||||||
|
else
|
||||||
|
php /tmp/mokostandards-api/deploy/deploy-sftp.php "${DEPLOY_ARGS[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f /tmp/deploy_key /tmp/sftp-config.json
|
||||||
|
|
||||||
|
- name: Summary
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.check.outputs.skip }}" = "true" ]; then
|
||||||
|
echo "### Deploy Skipped -- FTP not configured" >> $GITHUB_STEP_SUMMARY
|
||||||
|
else
|
||||||
|
echo "### Manual Dev Deploy Complete" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Host | \`${{ steps.check.outputs.host }}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Remote | \`${{ steps.check.outputs.remote }}\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Clear | ${{ inputs.clear_remote }} |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
fi
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: Gitea.Workflow
|
# DEFGROUP: Gitea.Workflow
|
||||||
# INGROUP: mokocli.Automation
|
# INGROUP: mokocli.Automation
|
||||||
# VERSION: 01.08.37
|
# VERSION: 01.00.00
|
||||||
# BRIEF: Auto-create feature branch when an issue is opened
|
# BRIEF: Auto-create feature branch when an issue is opened
|
||||||
|
|
||||||
name: "Universal: Issue Branch"
|
name: "Universal: Issue Branch"
|
||||||
@@ -19,7 +19,7 @@ permissions:
|
|||||||
issues: write
|
issues: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-branch:
|
create-branch:
|
||||||
@@ -28,8 +28,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Create branch and comment
|
- name: Create branch and comment
|
||||||
run: |
|
run: |
|
||||||
TOKEN="${{ secrets.GA_TOKEN }}"
|
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
||||||
API="${GITEA_URL}/api/v1/repos/${{ github.repository }}"
|
API="${MOKOGITEA_URL}/api/v1/repos/${{ github.repository }}"
|
||||||
ISSUE_NUM="${{ github.event.issue.number }}"
|
ISSUE_NUM="${{ github.event.issue.number }}"
|
||||||
ISSUE_TITLE="${{ github.event.issue.title }}"
|
ISSUE_TITLE="${{ github.event.issue.title }}"
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ jobs:
|
|||||||
echo "Created branch: ${BRANCH}"
|
echo "Created branch: ${BRANCH}"
|
||||||
|
|
||||||
# Comment on issue with branch link
|
# Comment on issue with branch link
|
||||||
REPO_URL="${GITEA_URL}/${{ github.repository }}"
|
REPO_URL="${MOKOGITEA_URL}/${{ github.repository }}"
|
||||||
BODY="Branch created: [\`${BRANCH}\`](${REPO_URL}/src/branch/${BRANCH})\n\n\`\`\`bash\ngit fetch origin\ngit checkout ${BRANCH}\n\`\`\`"
|
BODY="Branch created: [\`${BRANCH}\`](${REPO_URL}/src/branch/${BRANCH})\n\n\`\`\`bash\ngit fetch origin\ngit checkout ${BRANCH}\n\`\`\`"
|
||||||
|
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
|
|||||||
+521
-534
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
GITEA_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
|
GITEA_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
|
||||||
GITEA_REPO: ${{ vars.GITEA_REPO || github.event.repository.name }}
|
GITEA_REPO: ${{ vars.GITEA_REPO || github.event.repository.name }}
|
||||||
|
|
||||||
@@ -55,14 +55,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Validate metadata against Joomla manifest
|
- name: Validate metadata against Joomla manifest
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
php ${MOKO_CLI}/joomla_metadata_validate.php \
|
php ${MOKO_CLI}/joomla_metadata_validate.php \
|
||||||
--path . \
|
--path . \
|
||||||
--token "${GITEA_TOKEN}" \
|
--token "${MOKOGITEA_TOKEN}" \
|
||||||
--org "${GITEA_ORG}" \
|
--org "${GITEA_ORG}" \
|
||||||
--repo "${GITEA_REPO}" \
|
--repo "${GITEA_REPO}" \
|
||||||
--api-base "${GITEA_URL}/api/v1" \
|
--api-base "${MOKOGITEA_URL}/api/v1" \
|
||||||
--ci
|
--ci
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
# INGROUP: mokocli.Release
|
# INGROUP: mokocli.Release
|
||||||
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli
|
||||||
# PATH: /templates/workflows/universal/pre-release.yml.template
|
# PATH: /templates/workflows/universal/pre-release.yml.template
|
||||||
# VERSION: 05.01.00
|
# VERSION: 05.02.00
|
||||||
# BRIEF: Auto pre-release on push to dev/alpha/beta/rc branches
|
# BRIEF: Auto pre-release on push to dev/alpha/beta/rc branches
|
||||||
|
|
||||||
name: "Universal: Pre-Release"
|
name: "Universal: Pre-Release"
|
||||||
@@ -59,6 +59,11 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
token: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
ref: ${{ github.ref_name }}
|
ref: ${{ github.ref_name }}
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Update submodules to main
|
||||||
|
run: |
|
||||||
|
git submodule foreach --quiet 'git checkout main && git pull --quiet origin main' 2>/dev/null || true
|
||||||
|
|
||||||
- name: Setup mokocli tools
|
- name: Setup mokocli tools
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -29,12 +29,20 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Rename branch
|
- name: Rename branch
|
||||||
|
env:
|
||||||
|
BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
BRANCH="${{ github.event.pull_request.head.ref }}"
|
set -euo pipefail
|
||||||
|
# BRANCH is attacker-controlled (PR head ref). Strict allowlist before ANY use.
|
||||||
|
if ! printf '%s' "$BRANCH" | grep -Eq '^rc/[A-Za-z0-9._/-]+$'; then
|
||||||
|
echo "::error::Refusing unsafe branch name: $BRANCH"; exit 1
|
||||||
|
fi
|
||||||
SUFFIX="${BRANCH#rc/}"
|
SUFFIX="${BRANCH#rc/}"
|
||||||
DEV_BRANCH="dev/${SUFFIX}"
|
DEV_BRANCH="dev/${SUFFIX}"
|
||||||
API="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}/api/v1/repos/${{ github.repository }}/branches"
|
API="${GITEA_URL}/api/v1/repos/${REPO}/branches"
|
||||||
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
|
|
||||||
|
|
||||||
# Create dev/ branch from rc/ branch
|
# Create dev/ branch from rc/ branch
|
||||||
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X POST \
|
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X POST \
|
||||||
@@ -42,25 +50,22 @@ jobs:
|
|||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"new_branch_name\": \"${DEV_BRANCH}\", \"old_branch_name\": \"${BRANCH}\"}" \
|
-d "{\"new_branch_name\": \"${DEV_BRANCH}\", \"old_branch_name\": \"${BRANCH}\"}" \
|
||||||
"${API}" 2>/dev/null || true)
|
"${API}" 2>/dev/null || true)
|
||||||
|
|
||||||
if [ "$STATUS" = "201" ]; then
|
if [ "$STATUS" = "201" ]; then
|
||||||
echo "Created branch: ${DEV_BRANCH}" >> $GITHUB_STEP_SUMMARY
|
echo "Created branch: ${DEV_BRANCH}" >> "$GITHUB_STEP_SUMMARY"
|
||||||
else
|
else
|
||||||
echo "::error::Failed to create ${DEV_BRANCH} from ${BRANCH} (HTTP ${STATUS})"
|
echo "::error::Failed to create ${DEV_BRANCH} from ${BRANCH} (HTTP ${STATUS})"; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Delete rc/ branch
|
# Read BRANCH from the environment inside PHP (getenv, no string interpolation -> no PHP injection)
|
||||||
ENCODED=$(php -r "echo rawurlencode('${BRANCH}');")
|
ENCODED=$(php -r 'echo rawurlencode(getenv("BRANCH"));')
|
||||||
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X DELETE \
|
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" -X DELETE \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${TOKEN}" \
|
||||||
"${API}/${ENCODED}" 2>/dev/null || true)
|
"${API}/${ENCODED}" 2>/dev/null || true)
|
||||||
|
|
||||||
if [ "$STATUS" = "204" ]; then
|
if [ "$STATUS" = "204" ]; then
|
||||||
echo "Deleted branch: ${BRANCH}" >> $GITHUB_STEP_SUMMARY
|
echo "Deleted branch: ${BRANCH}" >> "$GITHUB_STEP_SUMMARY"
|
||||||
else
|
else
|
||||||
echo "::warning::Failed to delete ${BRANCH} (HTTP ${STATUS})"
|
echo "::warning::Failed to delete ${BRANCH} (HTTP ${STATUS})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "### RC Reverted" >> $GITHUB_STEP_SUMMARY
|
echo "### RC Reverted" >> "$GITHUB_STEP_SUMMARY"
|
||||||
echo "${BRANCH} → ${DEV_BRANCH}" >> $GITHUB_STEP_SUMMARY
|
echo "${BRANCH} → ${DEV_BRANCH}" >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -48,7 +48,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.MOKOGITEA_TOKEN || secrets.GA_TOKEN || github.token }}
|
token: ${{ secrets.MOKOGITEA_TOKEN || github.token }}
|
||||||
ref: ${{ inputs.branch || github.ref }}
|
ref: ${{ inputs.branch || github.ref }}
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
name: "Universal: Workflow Sync Trigger"
|
name: "Universal: Workflow Sync Trigger"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [closed]
|
types: [closed]
|
||||||
branches:
|
branches:
|
||||||
@@ -26,8 +27,9 @@ jobs:
|
|||||||
name: Sync workflows to live repos
|
name: Sync workflows to live repos
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: >-
|
if: >-
|
||||||
github.event.pull_request.merged == true &&
|
github.event_name == 'workflow_dispatch' ||
|
||||||
!contains(github.event.pull_request.title, '[skip sync]')
|
(github.event.pull_request.merged == true &&
|
||||||
|
!contains(github.event.pull_request.title, '[skip sync]'))
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Determine platform from repo name
|
- name: Determine platform from repo name
|
||||||
@@ -49,8 +51,14 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
GITEA_URL="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}"
|
MOKOGITEA_URL="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}"
|
||||||
git clone --depth 1 "${GITEA_URL}/MokoConsulting/mokocli.git" /tmp/mokocli
|
git clone --depth 1 "${MOKOGITEA_URL}/MokoConsulting/mokocli.git" /tmp/mokocli
|
||||||
|
|
||||||
|
- name: Install PHP
|
||||||
|
run: |
|
||||||
|
if ! command -v php &> /dev/null; then
|
||||||
|
apt-get update -qq && apt-get install -y -qq php-cli php-json php-curl > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
+2
-37
@@ -1,22 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
## [01.08.00] --- 2026-06-23
|
||||||
- **Instagram carousel**: Multi-image/video posts via Meta carousel container flow (up to 10 items)
|
|
||||||
- **Instagram Reels**: Short-form video publishing via REELS media type
|
|
||||||
- **Instagram Stories**: Image and video story publishing via STORIES media type
|
|
||||||
- **Instagram alt text**: Alt text support for image containers
|
|
||||||
- **Nostr plugin**: Full NIP-01 WebSocket relay publishing with BIP-340 Schnorr signatures (pure PHP, requires ext-gmp)
|
|
||||||
- **Nostr**: Publishes kind-1 text note events to multiple relays with automatic failover
|
|
||||||
- **Nostr**: Raw WebSocket client using stream_socket_client (no external dependencies)
|
|
||||||
- **Nostr**: Public key derivation and event signing via secp256k1 elliptic curve math
|
|
||||||
- **Threads carousel**: Support up to 20-item carousel posts via Threads API multi-container flow
|
|
||||||
- **Threads polls**: Poll creation support via poll_options parameter (2-4 options)
|
|
||||||
- **Threads spoiler tags**: Content warning / spoiler flag support for Threads posts
|
|
||||||
- **Threads text-only optimization**: Simplified single-step flow for text-only posts without media
|
|
||||||
|
|
||||||
### Fixed
|
## [01.08.00] --- 2026-06-23
|
||||||
- Webservices plugin Joomla 6 compatibility — `onBeforeApiRoute` receives `BeforeApiRouteEvent` object, extract router via `$event->getRouter()`
|
|
||||||
|
|
||||||
## [01.07.00] --- 2026-06-23
|
## [01.07.00] --- 2026-06-23
|
||||||
|
|
||||||
@@ -29,7 +16,6 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- **License warning**: Removed duplicate from system plugin (install script already shows it)
|
- **License warning**: Removed duplicate from system plugin (install script already shows it)
|
||||||
- **Content plugin**: Fixed func_get_arg crash when non-article content is saved (e.g. update sites, installer)
|
|
||||||
|
|
||||||
## [01.05.00] --- 2026-06-23
|
## [01.05.00] --- 2026-06-23
|
||||||
|
|
||||||
@@ -66,24 +52,3 @@
|
|||||||
- **Bluesky**: Replaced md5() with hash('sha256', ...) for cache key
|
- **Bluesky**: Replaced md5() with hash('sha256', ...) for cache key
|
||||||
- **ServiceController**: Exception details no longer exposed to client
|
- **ServiceController**: Exception details no longer exposed to client
|
||||||
- **License warning**: Removed duplicate from system plugin -- install script already shows it with direct edit link
|
- **License warning**: Removed duplicate from system plugin -- install script already shows it with direct edit link
|
||||||
|
|
||||||
## [01.04.01] --- 2026-06-21
|
|
||||||
|
|
||||||
|
|
||||||
## [01.04.01] --- 2026-06-21
|
|
||||||
|
|
||||||
|
|
||||||
## [01.04.00] --- 2026-06-21
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- **Package manifest**: Added missing `plg_system_mokosuitecross_events` and `plg_system_mokosuitecross_gallery` to `pkg_mokosuitecross.xml` — these system plugins were not installed with the package
|
|
||||||
- **Cleanup**: Removed old `src/` directory (pre-rename cruft with `mokojoomcross` files)
|
|
||||||
|
|
||||||
## [01.03.00] --- 2026-06-21
|
|
||||||
|
|
||||||
|
|
||||||
<!-- VERSION: 01.08.37 -->
|
|
||||||
|
|
||||||
All notable changes to MokoSuiteCross will be documented in this file.
|
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
DEFGROUP: Template-Joomla
|
DEFGROUP: Template-Joomla
|
||||||
INGROUP: Template-Joomla.Documentation
|
INGROUP: Template-Joomla.Documentation
|
||||||
REPO: https://github.com/mokoconsulting-tech/Template-Joomla/
|
REPO: https://github.com/mokoconsulting-tech/Template-Joomla/
|
||||||
VERSION: 01.08.37
|
VERSION: 01.01.00
|
||||||
PATH: ./CODE_OF_CONDUCT.md
|
PATH: ./CODE_OF_CONDUCT.md
|
||||||
BRIEF: Community expectations and enforcement guidelines
|
BRIEF: Community expectations and enforcement guidelines
|
||||||
NOTE: Adapted with attribution from the Contributor Covenant v2.1
|
NOTE: Adapted with attribution from the Contributor Covenant v2.1
|
||||||
|
|||||||
+119
-1
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
|||||||
# MokoSuiteCross
|
# MokoSuiteCross
|
||||||
|
|
||||||
<!-- VERSION: 01.08.37 -->
|
<!-- VERSION: 01.08.00 -->
|
||||||
|
|
||||||
Cross-posting Joomla content to social media, email marketing, and chat platforms for Joomla 5/6.
|
Cross-posting Joomla content to social media, email marketing, and chat platforms for Joomla 5/6.
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -23,7 +23,7 @@ DEFGROUP: Template-Joomla
|
|||||||
INGROUP: Template-Joomla.Documentation
|
INGROUP: Template-Joomla.Documentation
|
||||||
REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla
|
REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-Joomla
|
||||||
PATH: /SECURITY.md
|
PATH: /SECURITY.md
|
||||||
VERSION: 01.08.37
|
VERSION: 01.01.00
|
||||||
BRIEF: Security vulnerability reporting and handling policy
|
BRIEF: Security vulnerability reporting and handling policy
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@@ -224,10 +224,10 @@ The following are explicitly out of scope:
|
|||||||
|
|
||||||
## Metadata
|
## Metadata
|
||||||
|
|
||||||
| Field | Value |
|
| Field | Value |
|
||||||
| ------------ | ------------------------------------------------------------------------------------------------------------ |
|
| ------------ | ------------------------------------------------------------------------------------------------------------ |
|
||||||
| Document | Security Policy |
|
| Document | Security Policy |
|
||||||
| Path | /SECURITY.md |
|
| Path | /SECURITY.md |
|
||||||
| Repository | [https://github.com/mokoconsulting-tech/Template-Joomla](https://github.com/mokoconsulting-tech/Template-Joomla) |
|
| Repository | [https://github.com/mokoconsulting-tech/Template-Joomla](https://github.com/mokoconsulting-tech/Template-Joomla) |
|
||||||
| Owner | Moko Consulting |
|
| Owner | Moko Consulting |
|
||||||
| Scope | Security vulnerability handling |
|
| Scope | Security vulnerability handling |
|
||||||
|
|||||||
+5
-3
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mokoconsulting/mokosuitecross",
|
"name": "mokoconsulting/mokojoomgallery",
|
||||||
"description": "Cross-posting Joomla content to social media, email marketing, and chat platforms",
|
"description": "Photo gallery management for Joomla — galleries, images, thumbnails, lightbox, and frontend display",
|
||||||
"type": "joomla-package",
|
"type": "joomla-package",
|
||||||
"version": "01.00.00",
|
"version": "01.00.00",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
@@ -17,8 +17,10 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"squizlabs/php_codesniffer": "^3.7",
|
"squizlabs/php_codesniffer": "^3.7",
|
||||||
"phpstan/phpstan": "^1.10",
|
"phpstan/phpstan": "^1.10",
|
||||||
"joomla/coding-standards": "^4.0"
|
"joomla/coding-standards": "3.0.x-dev"
|
||||||
},
|
},
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"prefer-stable": true,
|
||||||
"config": {
|
"config": {
|
||||||
"sort-packages": true
|
"sort-packages": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
; License: GPL-3.0-or-later
|
; License: GPL-3.0-or-later
|
||||||
|
|
||||||
PKG_MOKOSUITECROSS="MokoSuiteCross"
|
PKG_MOKOSUITECROSS="MokoSuiteCross"
|
||||||
PKG_MOKOSUITECROSS_DESCRIPTION="Cross-post Joomla articles to 38 platforms including Facebook, Instagram, X/Twitter, LinkedIn, Threads, Mastodon, Bluesky, Nostr, TikTok, YouTube, Pinterest, Reddit, Medium, Telegram, Discord, Slack, Teams, Mailchimp, SendGrid, Brevo, and more. Features scheduled posting, template placeholders, UTM tagging, link shortening, caption rotation, and per-article service selection."
|
PKG_MOKOSUITECROSS_DESCRIPTION="Cross-posting Joomla content to social media, email marketing, and chat platforms. Automatically publish articles to Facebook, X/Twitter, LinkedIn, Mastodon, Bluesky, Mailchimp, Telegram, Discord, and Slack."
|
||||||
PKG_MOKOSUITECROSS_PHP_VERSION_ERROR="MokoSuiteCross requires PHP %s or later."
|
PKG_MOKOSUITECROSS_PHP_VERSION_ERROR="MokoSuiteCross requires PHP %s or later."
|
||||||
PKG_MOKOSUITECROSS_MIGRATION_DETECTED="Perfect Publisher Pro detected! Navigate to Components → MokoSuiteCross → Dashboard to migrate your settings."
|
PKG_MOKOSUITECROSS_MIGRATION_DETECTED="Perfect Publisher Pro detected! Navigate to Components → MokoSuiteCross → Dashboard to migrate your settings."
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="component" method="upgrade">
|
<extension type="component" method="upgrade">
|
||||||
<name>com_mokosuitecross</name>
|
<name>com_mokosuitecross</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.05 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.07 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.08 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.09 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.10 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.11 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.12 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.13 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.14 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.15 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.16 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.17 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.19 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.20 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.21 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.22 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.23 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.24 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.25 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.26 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.27 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.28 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.29 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.30 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.31 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.32 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.33 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.34 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.35 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.36 — no schema changes */
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/* 01.08.37 — no schema changes */
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="content" method="upgrade">
|
<extension type="plugin" group="content" method="upgrade">
|
||||||
<name>Content - MokoSuiteCross</name>
|
<name>Content - MokoSuiteCross</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
+42
-13
@@ -270,11 +270,25 @@ XML;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add cross-post status badges before article content in admin.
|
* Add cross-post status badges before article content in admin.
|
||||||
|
*
|
||||||
|
* Joomla 5/6 compatible — accepts both BeforeDisplayEvent and legacy parameters.
|
||||||
*/
|
*/
|
||||||
public function onContentBeforeDisplay(\Joomla\CMS\Event\Content\BeforeDisplayEvent $event): string
|
public function onContentBeforeDisplay($event): string
|
||||||
{
|
{
|
||||||
$context = $event->getContext();
|
// Joomla 5/6 compatibility
|
||||||
$article = $event->getItem();
|
if ($event instanceof \Joomla\CMS\Event\Content\BeforeDisplayEvent) {
|
||||||
|
$context = $event->getContext();
|
||||||
|
$article = $event->getItem();
|
||||||
|
} elseif (is_string($event)) {
|
||||||
|
$context = $event;
|
||||||
|
$article = func_get_arg(1);
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($context !== 'com_content.article') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$app = $this->getApplication();
|
$app = $this->getApplication();
|
||||||
|
|
||||||
@@ -316,18 +330,26 @@ XML;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch cross-post when an article is saved and published.
|
* Dispatch cross-post when an article is saved and published.
|
||||||
|
*
|
||||||
|
* Joomla 5/6 compatible — accepts both AfterSaveEvent and legacy parameters.
|
||||||
*/
|
*/
|
||||||
public function onContentAfterSave(\Joomla\CMS\Event\Content\AfterSaveEvent $event): void
|
public function onContentAfterSave($event): void
|
||||||
{
|
{
|
||||||
$context = $event->getContext();
|
// Joomla 5/6 compatibility
|
||||||
|
if ($event instanceof \Joomla\CMS\Event\Content\AfterSaveEvent) {
|
||||||
|
$context = $event->getContext();
|
||||||
|
$article = $event->getItem();
|
||||||
|
$isNew = $event->getIsNew();
|
||||||
|
} else {
|
||||||
|
$context = $event;
|
||||||
|
$article = func_get_arg(1);
|
||||||
|
$isNew = func_get_arg(2);
|
||||||
|
}
|
||||||
|
|
||||||
if ($context !== 'com_content.article') {
|
if ($context !== 'com_content.article') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$article = $event->getItem();
|
|
||||||
$isNew = $event->getIsNew();
|
|
||||||
|
|
||||||
if ((int) ($article->state ?? 0) !== 1) {
|
if ((int) ($article->state ?? 0) !== 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -353,18 +375,25 @@ XML;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch cross-post when article state changes to published.
|
* Dispatch cross-post when article state changes to published.
|
||||||
|
*
|
||||||
|
* Joomla 5/6 compatible — accepts both ContentChangeStateEvent and legacy parameters.
|
||||||
*/
|
*/
|
||||||
public function onContentChangeState(\Joomla\CMS\Event\Content\ContentChangeStateEvent $event): void
|
public function onContentChangeState($event): void
|
||||||
{
|
{
|
||||||
$context = $event->getContext();
|
if ($event instanceof \Joomla\CMS\Event\Content\ContentChangeStateEvent) {
|
||||||
|
$context = $event->getContext();
|
||||||
|
$pks = $event->getPks();
|
||||||
|
$value = $event->getValue();
|
||||||
|
} else {
|
||||||
|
$context = $event;
|
||||||
|
$pks = func_get_arg(1);
|
||||||
|
$value = func_get_arg(2);
|
||||||
|
}
|
||||||
|
|
||||||
if ($context !== 'com_content.article') {
|
if ($context !== 'com_content.article') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pks = $event->getPks();
|
|
||||||
$value = $event->getValue();
|
|
||||||
|
|
||||||
$params = ComponentHelper::getParams('com_mokosuitecross');
|
$params = ComponentHelper::getParams('com_mokosuitecross');
|
||||||
|
|
||||||
// Unpublish/trash: delete from platforms if configured
|
// Unpublish/trash: delete from platforms if configured
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - ActivityPub (Fediverse)</name>
|
<name>MokoSuiteCross - ActivityPub (Fediverse)</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Google Blogger</name>
|
<name>MokoSuiteCross - Google Blogger</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Bluesky</name>
|
<name>MokoSuiteCross - Bluesky</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Brevo (Sendinblue)</name>
|
<name>MokoSuiteCross - Brevo (Sendinblue)</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Constant Contact</name>
|
<name>MokoSuiteCross - Constant Contact</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - ConvertKit</name>
|
<name>MokoSuiteCross - ConvertKit</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Dev.to</name>
|
<name>MokoSuiteCross - Dev.to</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Discord</name>
|
<name>MokoSuiteCross - Discord</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Facebook / Meta</name>
|
<name>MokoSuiteCross - Facebook / Meta</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Ghost</name>
|
<name>MokoSuiteCross - Ghost</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Google Business Profile</name>
|
<name>MokoSuiteCross - Google Business Profile</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Google Chat</name>
|
<name>MokoSuiteCross - Google Chat</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Hashnode</name>
|
<name>MokoSuiteCross - Hashnode</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Instagram</name>
|
<name>MokoSuiteCross - Instagram</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-06-23</creationDate>
|
<creationDate>2026-06-23</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use Joomla\Event\SubscriberInterface;
|
|||||||
/**
|
/**
|
||||||
* Instagram service plugin for MokoSuiteCross.
|
* Instagram service plugin for MokoSuiteCross.
|
||||||
*
|
*
|
||||||
* Uses the Meta Content Publishing API -- a 2-step flow:
|
* Uses the Meta Content Publishing API — a 2-step flow:
|
||||||
* 1. Create a media container via POST /{ig_user_id}/media
|
* 1. Create a media container via POST /{ig_user_id}/media
|
||||||
* 2. Publish the container via POST /{ig_user_id}/media_publish
|
* 2. Publish the container via POST /{ig_user_id}/media_publish
|
||||||
*/
|
*/
|
||||||
@@ -50,128 +50,24 @@ class InstagramService extends CMSPlugin implements SubscriberInterface, MokoSui
|
|||||||
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Missing access token or Instagram account ID.']];
|
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Missing access token or Instagram account ID.']];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($media)) {
|
// Step 1: Create media container
|
||||||
|
$containerUrl = 'https://graph.facebook.com/v19.0/' . urlencode($accountId) . '/media';
|
||||||
|
$containerData = [
|
||||||
|
'caption' => mb_substr($message, 0, 2200),
|
||||||
|
'access_token' => $token,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Attach image if provided
|
||||||
|
if (!empty($media[0])) {
|
||||||
|
$containerData['image_url'] = $media[0];
|
||||||
|
} else {
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Instagram requires at least one image or video.']];
|
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Instagram requires at least one image or video.']];
|
||||||
}
|
}
|
||||||
|
|
||||||
$caption = mb_substr($message, 0, 2200);
|
$ch = curl_init($containerUrl);
|
||||||
$mediaType = $params['media_type'] ?? '';
|
|
||||||
$altText = $params['alt_text'] ?? '';
|
|
||||||
|
|
||||||
if ($mediaType === 'reels') {
|
|
||||||
return $this->publishReels($accountId, $token, $caption, $media[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($mediaType === 'stories') {
|
|
||||||
return $this->publishStories($accountId, $token, $media[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (\count($media) > 1) {
|
|
||||||
return $this->publishCarousel($accountId, $token, $caption, $media, $altText);
|
|
||||||
}
|
|
||||||
|
|
||||||
$fields = [
|
|
||||||
'caption' => $caption,
|
|
||||||
'image_url' => $media[0],
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($altText !== '') {
|
|
||||||
$fields['alt_text'] = $altText;
|
|
||||||
}
|
|
||||||
|
|
||||||
$container = $this->createContainer($accountId, $token, $fields);
|
|
||||||
|
|
||||||
if (!$container['success']) {
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => $container['data'] ?? ['error' => $container['error']]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->publishContainer($accountId, $token, $container['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function publishCarousel(string $accountId, string $token, string $caption, array $media, string $altText): array
|
|
||||||
{
|
|
||||||
$media = \array_slice($media, 0, 10);
|
|
||||||
$childIds = [];
|
|
||||||
|
|
||||||
foreach ($media as $url) {
|
|
||||||
$fields = ['is_carousel_item' => 'true'];
|
|
||||||
|
|
||||||
if ($this->isVideoUrl($url)) {
|
|
||||||
$fields['video_url'] = $url;
|
|
||||||
} else {
|
|
||||||
$fields['image_url'] = $url;
|
|
||||||
|
|
||||||
if ($altText !== '') {
|
|
||||||
$fields['alt_text'] = $altText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$child = $this->createContainer($accountId, $token, $fields);
|
|
||||||
|
|
||||||
if (!$child['success']) {
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => $child['data'] ?? ['error' => $child['error']]];
|
|
||||||
}
|
|
||||||
|
|
||||||
$childIds[] = $child['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$carousel = $this->createContainer($accountId, $token, [
|
|
||||||
'media_type' => 'CAROUSEL',
|
|
||||||
'caption' => $caption,
|
|
||||||
'children' => implode(',', $childIds),
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (!$carousel['success']) {
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => $carousel['data'] ?? ['error' => $carousel['error']]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->publishContainer($accountId, $token, $carousel['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function publishReels(string $accountId, string $token, string $caption, string $videoUrl): array
|
|
||||||
{
|
|
||||||
$container = $this->createContainer($accountId, $token, [
|
|
||||||
'media_type' => 'REELS',
|
|
||||||
'video_url' => $videoUrl,
|
|
||||||
'caption' => $caption,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (!$container['success']) {
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => $container['data'] ?? ['error' => $container['error']]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->publishContainer($accountId, $token, $container['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function publishStories(string $accountId, string $token, string $mediaUrl): array
|
|
||||||
{
|
|
||||||
$fields = ['media_type' => 'STORIES'];
|
|
||||||
|
|
||||||
if ($this->isVideoUrl($mediaUrl)) {
|
|
||||||
$fields['video_url'] = $mediaUrl;
|
|
||||||
} else {
|
|
||||||
$fields['image_url'] = $mediaUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
$container = $this->createContainer($accountId, $token, $fields);
|
|
||||||
|
|
||||||
if (!$container['success']) {
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => $container['data'] ?? ['error' => $container['error']]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->publishContainer($accountId, $token, $container['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createContainer(string $accountId, string $token, array $fields): array
|
|
||||||
{
|
|
||||||
$url = 'https://graph.facebook.com/v19.0/' . urlencode($accountId) . '/media';
|
|
||||||
|
|
||||||
$fields['access_token'] = $token;
|
|
||||||
|
|
||||||
$ch = curl_init($url);
|
|
||||||
curl_setopt_array($ch, [
|
curl_setopt_array($ch, [
|
||||||
CURLOPT_POST => true,
|
CURLOPT_POST => true,
|
||||||
CURLOPT_POSTFIELDS => http_build_query($fields),
|
CURLOPT_POSTFIELDS => http_build_query($containerData),
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_TIMEOUT => 30,
|
CURLOPT_TIMEOUT => 30,
|
||||||
]);
|
]);
|
||||||
@@ -179,34 +75,36 @@ class InstagramService extends CMSPlugin implements SubscriberInterface, MokoSui
|
|||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
if ($response === false) {
|
if ($response === false) {
|
||||||
$curlError = curl_error($ch);
|
|
||||||
curl_close($ch);
|
|
||||||
return ['success' => false, 'error' => 'Connection error: ' . $curlError];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$curlError = curl_error($ch);
|
||||||
|
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Connection error: ' . $curlError]];
|
||||||
|
|
||||||
|
}
|
||||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
$data = json_decode($response, true) ?: [];
|
$data = json_decode($response, true) ?: [];
|
||||||
|
|
||||||
if ($httpCode < 200 || $httpCode >= 300 || empty($data['id'])) {
|
if ($httpCode < 200 || $httpCode >= 300 || empty($data['id'])) {
|
||||||
return ['success' => false, 'error' => $data['error']['message'] ?? 'Container creation failed', 'data' => $data];
|
return ['success' => false, 'platform_post_id' => '', 'response' => $data];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['success' => true, 'id' => $data['id'], 'data' => $data];
|
$containerId = $data['id'];
|
||||||
}
|
|
||||||
|
|
||||||
private function publishContainer(string $accountId, string $token, string $containerId): array
|
// Step 2: Publish the container
|
||||||
{
|
$publishUrl = 'https://graph.facebook.com/v19.0/' . urlencode($accountId) . '/media_publish';
|
||||||
$url = 'https://graph.facebook.com/v19.0/' . urlencode($accountId) . '/media_publish';
|
$publishData = [
|
||||||
|
'creation_id' => $containerId,
|
||||||
|
'access_token' => $token,
|
||||||
|
];
|
||||||
|
|
||||||
$ch = curl_init($url);
|
$ch = curl_init($publishUrl);
|
||||||
curl_setopt_array($ch, [
|
curl_setopt_array($ch, [
|
||||||
CURLOPT_POST => true,
|
CURLOPT_POST => true,
|
||||||
CURLOPT_POSTFIELDS => http_build_query([
|
CURLOPT_POSTFIELDS => http_build_query($publishData),
|
||||||
'creation_id' => $containerId,
|
|
||||||
'access_token' => $token,
|
|
||||||
]),
|
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_TIMEOUT => 30,
|
CURLOPT_TIMEOUT => 30,
|
||||||
]);
|
]);
|
||||||
@@ -214,11 +112,14 @@ class InstagramService extends CMSPlugin implements SubscriberInterface, MokoSui
|
|||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
if ($response === false) {
|
if ($response === false) {
|
||||||
$curlError = curl_error($ch);
|
|
||||||
curl_close($ch);
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Connection error: ' . $curlError]];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$curlError = curl_error($ch);
|
||||||
|
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Connection error: ' . $curlError]];
|
||||||
|
|
||||||
|
}
|
||||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
@@ -231,11 +132,6 @@ class InstagramService extends CMSPlugin implements SubscriberInterface, MokoSui
|
|||||||
return ['success' => false, 'platform_post_id' => '', 'response' => $data];
|
return ['success' => false, 'platform_post_id' => '', 'response' => $data];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isVideoUrl(string $url): bool
|
|
||||||
{
|
|
||||||
return (bool) preg_match('/\.(mp4|mov|avi|wmv|webm)(\?|$)/i', $url);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function validateCredentials(array $credentials): array
|
public function validateCredentials(array $credentials): array
|
||||||
{
|
{
|
||||||
$token = $this->resolveCredential($credentials, 'access_token');
|
$token = $this->resolveCredential($credentials, 'access_token');
|
||||||
@@ -254,9 +150,13 @@ class InstagramService extends CMSPlugin implements SubscriberInterface, MokoSui
|
|||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
if ($response === false) {
|
if ($response === false) {
|
||||||
|
|
||||||
$curlError = curl_error($ch);
|
$curlError = curl_error($ch);
|
||||||
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
return ['valid' => false, 'message' => 'Connection error: ' . $curlError, 'account_name' => ''];
|
return ['valid' => false, 'message' => 'Connection error: ' . $curlError, 'account_name' => ''];
|
||||||
|
|
||||||
}
|
}
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
@@ -283,6 +183,6 @@ class InstagramService extends CMSPlugin implements SubscriberInterface, MokoSui
|
|||||||
|
|
||||||
public function getSupportedMediaTypes(): array
|
public function getSupportedMediaTypes(): array
|
||||||
{
|
{
|
||||||
return ['image', 'video', 'carousel', 'reels', 'stories'];
|
return ['image', 'video'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - LinkedIn</name>
|
<name>MokoSuiteCross - LinkedIn</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Mailchimp</name>
|
<name>MokoSuiteCross - Mailchimp</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Mastodon</name>
|
<name>MokoSuiteCross - Mastodon</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Matrix / Element</name>
|
<name>MokoSuiteCross - Matrix / Element</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Medium</name>
|
<name>MokoSuiteCross - Medium</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - MokoSuiteCalendar Events</name>
|
<name>MokoSuiteCross - MokoSuiteCalendar Events</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - MokoSuiteGallery</name>
|
<name>MokoSuiteCross - MokoSuiteGallery</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
PLG_MOKOSUITECROSS_NOSTR="MokoSuiteCross - Nostr"
|
PLG_MOKOSUITECROSS_NOSTR="MokoSuiteCross - Nostr"
|
||||||
PLG_MOKOSUITECROSS_NOSTR_DESCRIPTION="Cross-post Joomla articles to Nostr relays via NIP-01 WebSocket protocol. Requires PHP ext-gmp for secp256k1 Schnorr signing."
|
PLG_MOKOSUITECROSS_NOSTR_DESCRIPTION="Cross-post Joomla articles to Nostr."
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Nostr</name>
|
<name>MokoSuiteCross - Nostr</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -20,18 +20,12 @@ use Joomla\Event\SubscriberInterface;
|
|||||||
/**
|
/**
|
||||||
* Nostr service plugin for MokoSuiteCross.
|
* Nostr service plugin for MokoSuiteCross.
|
||||||
*
|
*
|
||||||
* Publishes kind-1 text note events to NIP-01 WebSocket relays.
|
* Nostr uses NIP-01 WebSocket relays for event publishing.
|
||||||
* Uses BIP-340 Schnorr signatures over secp256k1 (requires ext-gmp).
|
* This is a stub — full WebSocket implementation is deferred.
|
||||||
*
|
* Events are signed with the private key and sent to configured relays.
|
||||||
* Credentials: private_key (64-char hex nsec), relays (comma-separated wss:// URLs)
|
|
||||||
*/
|
*/
|
||||||
class NostrService extends CMSPlugin implements SubscriberInterface, MokoSuiteCrossServiceInterface
|
class NostrService extends CMSPlugin implements SubscriberInterface, MokoSuiteCrossServiceInterface
|
||||||
{
|
{
|
||||||
private const SECP256K1_P = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F';
|
|
||||||
private const SECP256K1_N = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141';
|
|
||||||
private const SECP256K1_GX = '79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798';
|
|
||||||
private const SECP256K1_GY = '483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8';
|
|
||||||
|
|
||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return ['onMokoSuiteCrossGetServices' => 'onMokoSuiteCrossGetServices'];
|
return ['onMokoSuiteCrossGetServices' => 'onMokoSuiteCrossGetServices'];
|
||||||
@@ -49,10 +43,6 @@ class NostrService extends CMSPlugin implements SubscriberInterface, MokoSuiteCr
|
|||||||
|
|
||||||
public function publish(string $message, array $media, array $credentials, array $params): array
|
public function publish(string $message, array $media, array $credentials, array $params): array
|
||||||
{
|
{
|
||||||
if (!extension_loaded('gmp')) {
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'PHP ext-gmp is required for Nostr signing.']];
|
|
||||||
}
|
|
||||||
|
|
||||||
$privateKey = $credentials['private_key'] ?? '';
|
$privateKey = $credentials['private_key'] ?? '';
|
||||||
$relays = $credentials['relays'] ?? '';
|
$relays = $credentials['relays'] ?? '';
|
||||||
|
|
||||||
@@ -60,393 +50,48 @@ class NostrService extends CMSPlugin implements SubscriberInterface, MokoSuiteCr
|
|||||||
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Missing private key or relay URLs.']];
|
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Missing private key or relay URLs.']];
|
||||||
}
|
}
|
||||||
|
|
||||||
$privateKey = strtolower(trim($privateKey));
|
// Nostr requires WebSocket connections to relays (wss://).
|
||||||
|
// Full NIP-01 event signing and relay publishing is not yet implemented.
|
||||||
if (!preg_match('/^[0-9a-f]{64}$/', $privateKey)) {
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Private key must be 64 hex characters.']];
|
|
||||||
}
|
|
||||||
|
|
||||||
$pubkey = $this->getPublicKey($privateKey);
|
|
||||||
|
|
||||||
$event = $this->createEvent($pubkey, $message);
|
|
||||||
$event['sig'] = $this->schnorrSign($event['id'], $privateKey);
|
|
||||||
|
|
||||||
$relayList = array_filter(array_map('trim', explode(',', $relays)));
|
|
||||||
$lastError = '';
|
|
||||||
$published = false;
|
|
||||||
|
|
||||||
foreach ($relayList as $relayUrl) {
|
|
||||||
$result = $this->publishToRelay($relayUrl, $event);
|
|
||||||
|
|
||||||
if ($result['success']) {
|
|
||||||
$published = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$lastError = $result['error'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$published) {
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'All relays failed. Last: ' . $lastError]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'success' => true,
|
'success' => false,
|
||||||
'platform_post_id' => $event['id'],
|
'platform_post_id' => '',
|
||||||
'response' => ['event_id' => $event['id'], 'relay' => $relayUrl ?? ''],
|
'response' => ['error' => 'Nostr WebSocket relay publishing is not yet implemented. This service will be available in a future release.'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateCredentials(array $credentials): array
|
public function validateCredentials(array $credentials): array
|
||||||
{
|
{
|
||||||
if (!extension_loaded('gmp')) {
|
$privateKey = $credentials['private_key'] ?? '';
|
||||||
return ['valid' => false, 'message' => 'PHP ext-gmp is required for Nostr.', 'account_name' => ''];
|
|
||||||
}
|
|
||||||
|
|
||||||
$privateKey = strtolower(trim($credentials['private_key'] ?? ''));
|
|
||||||
$relays = $credentials['relays'] ?? '';
|
$relays = $credentials['relays'] ?? '';
|
||||||
|
|
||||||
if (empty($privateKey)) {
|
if (empty($privateKey)) {
|
||||||
return ['valid' => false, 'message' => 'Private key is required.', 'account_name' => ''];
|
return ['valid' => false, 'message' => 'Private key is required.', 'account_name' => ''];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^[0-9a-f]{64}$/', $privateKey)) {
|
|
||||||
return ['valid' => false, 'message' => 'Private key must be 64 hex characters.', 'account_name' => ''];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($relays)) {
|
if (empty($relays)) {
|
||||||
return ['valid' => false, 'message' => 'At least one relay URL is required.', 'account_name' => ''];
|
return ['valid' => false, 'message' => 'At least one relay URL is required.', 'account_name' => ''];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate that relay URLs look like WebSocket URLs
|
||||||
$relayList = array_filter(array_map('trim', explode(',', $relays)));
|
$relayList = array_filter(array_map('trim', explode(',', $relays)));
|
||||||
|
$valid = true;
|
||||||
|
|
||||||
foreach ($relayList as $relay) {
|
foreach ($relayList as $relay) {
|
||||||
if (!str_starts_with($relay, 'wss://') && !str_starts_with($relay, 'ws://')) {
|
if (!str_starts_with($relay, 'wss://') && !str_starts_with($relay, 'ws://')) {
|
||||||
return ['valid' => false, 'message' => 'Relay URLs must start with wss:// or ws://.', 'account_name' => ''];
|
$valid = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pubkey = $this->getPublicKey($privateKey);
|
if (!$valid) {
|
||||||
$npub = substr($pubkey, 0, 16) . '...';
|
return ['valid' => false, 'message' => 'Relay URLs must start with wss:// or ws://.', 'account_name' => ''];
|
||||||
|
}
|
||||||
|
|
||||||
return ['valid' => true, 'message' => count($relayList) . ' relay(s) configured', 'account_name' => 'npub:' . $npub];
|
return ['valid' => true, 'message' => 'Credentials configured (' . count($relayList) . ' relay(s))', 'account_name' => 'Nostr'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSupportedMediaTypes(): array
|
public function getSupportedMediaTypes(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- NIP-01 event creation --
|
|
||||||
|
|
||||||
private function createEvent(string $pubkey, string $content, int $kind = 1, array $tags = []): array
|
|
||||||
{
|
|
||||||
$createdAt = time();
|
|
||||||
$serialized = json_encode([0, $pubkey, $createdAt, $kind, $tags, $content], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
||||||
$id = hash('sha256', $serialized);
|
|
||||||
|
|
||||||
return [
|
|
||||||
'id' => $id,
|
|
||||||
'pubkey' => $pubkey,
|
|
||||||
'created_at' => $createdAt,
|
|
||||||
'kind' => $kind,
|
|
||||||
'tags' => $tags,
|
|
||||||
'content' => $content,
|
|
||||||
'sig' => '',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// -- WebSocket relay publishing --
|
|
||||||
|
|
||||||
private function publishToRelay(string $relayUrl, array $event): array
|
|
||||||
{
|
|
||||||
$parsed = parse_url($relayUrl);
|
|
||||||
|
|
||||||
if (!$parsed || !isset($parsed['host'])) {
|
|
||||||
return ['success' => false, 'error' => 'Invalid relay URL'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$scheme = $parsed['scheme'] ?? 'wss';
|
|
||||||
$host = $parsed['host'];
|
|
||||||
$port = $parsed['port'] ?? ($scheme === 'wss' ? 443 : 80);
|
|
||||||
$path = $parsed['path'] ?? '/';
|
|
||||||
$useTls = ($scheme === 'wss');
|
|
||||||
|
|
||||||
$address = ($useTls ? 'tls://' : 'tcp://') . $host . ':' . $port;
|
|
||||||
$context = stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true]]);
|
|
||||||
|
|
||||||
$socket = @stream_socket_client($address, $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context);
|
|
||||||
|
|
||||||
if (!$socket) {
|
|
||||||
return ['success' => false, 'error' => "Connection failed: {$errstr} ({$errno})"];
|
|
||||||
}
|
|
||||||
|
|
||||||
stream_set_timeout($socket, 10);
|
|
||||||
|
|
||||||
// WebSocket upgrade handshake
|
|
||||||
$wsKey = base64_encode(random_bytes(16));
|
|
||||||
$handshake = "GET {$path} HTTP/1.1\r\n"
|
|
||||||
. "Host: {$host}\r\n"
|
|
||||||
. "Upgrade: websocket\r\n"
|
|
||||||
. "Connection: Upgrade\r\n"
|
|
||||||
. "Sec-WebSocket-Key: {$wsKey}\r\n"
|
|
||||||
. "Sec-WebSocket-Version: 13\r\n"
|
|
||||||
. "\r\n";
|
|
||||||
|
|
||||||
fwrite($socket, $handshake);
|
|
||||||
|
|
||||||
$response = '';
|
|
||||||
|
|
||||||
while (($line = fgets($socket)) !== false) {
|
|
||||||
$response .= $line;
|
|
||||||
|
|
||||||
if (trim($line) === '') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strpos($response, '101') === false) {
|
|
||||||
fclose($socket);
|
|
||||||
|
|
||||||
return ['success' => false, 'error' => 'WebSocket upgrade failed'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send EVENT message
|
|
||||||
$payload = json_encode(['EVENT', $event], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
||||||
$this->wsWrite($socket, $payload);
|
|
||||||
|
|
||||||
// Read OK response (with timeout)
|
|
||||||
$reply = $this->wsRead($socket);
|
|
||||||
fclose($socket);
|
|
||||||
|
|
||||||
if ($reply === null) {
|
|
||||||
return ['success' => false, 'error' => 'No response from relay'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$decoded = json_decode($reply, true);
|
|
||||||
|
|
||||||
if (!is_array($decoded) || ($decoded[0] ?? '') !== 'OK') {
|
|
||||||
$msg = is_array($decoded) ? ($decoded[3] ?? $decoded[2] ?? 'Unknown error') : 'Invalid response';
|
|
||||||
|
|
||||||
return ['success' => false, 'error' => (string) $msg];
|
|
||||||
}
|
|
||||||
|
|
||||||
// ["OK", event_id, true/false, message]
|
|
||||||
$accepted = $decoded[2] ?? false;
|
|
||||||
|
|
||||||
if (!$accepted) {
|
|
||||||
return ['success' => false, 'error' => $decoded[3] ?? 'Relay rejected event'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return ['success' => true, 'error' => ''];
|
|
||||||
}
|
|
||||||
|
|
||||||
private function wsWrite($socket, string $data): void
|
|
||||||
{
|
|
||||||
$len = strlen($data);
|
|
||||||
$frame = chr(0x81); // text frame, FIN bit set
|
|
||||||
$mask = random_bytes(4);
|
|
||||||
|
|
||||||
if ($len < 126) {
|
|
||||||
$frame .= chr($len | 0x80); // mask bit set
|
|
||||||
} elseif ($len < 65536) {
|
|
||||||
$frame .= chr(126 | 0x80) . pack('n', $len);
|
|
||||||
} else {
|
|
||||||
$frame .= chr(127 | 0x80) . pack('J', $len);
|
|
||||||
}
|
|
||||||
|
|
||||||
$frame .= $mask;
|
|
||||||
|
|
||||||
for ($i = 0; $i < $len; $i++) {
|
|
||||||
$frame .= $data[$i] ^ $mask[$i % 4];
|
|
||||||
}
|
|
||||||
|
|
||||||
fwrite($socket, $frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function wsRead($socket): ?string
|
|
||||||
{
|
|
||||||
$header = fread($socket, 2);
|
|
||||||
|
|
||||||
if ($header === false || strlen($header) < 2) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$len = ord($header[1]) & 0x7F;
|
|
||||||
|
|
||||||
if ($len === 126) {
|
|
||||||
$ext = fread($socket, 2);
|
|
||||||
$len = unpack('n', $ext)[1];
|
|
||||||
} elseif ($len === 127) {
|
|
||||||
$ext = fread($socket, 8);
|
|
||||||
$len = unpack('J', $ext)[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$masked = (ord($header[1]) & 0x80) !== 0;
|
|
||||||
$mask = $masked ? fread($socket, 4) : '';
|
|
||||||
$data = '';
|
|
||||||
|
|
||||||
while (strlen($data) < $len) {
|
|
||||||
$chunk = fread($socket, $len - strlen($data));
|
|
||||||
|
|
||||||
if ($chunk === false) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data .= $chunk;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($masked) {
|
|
||||||
for ($i = 0; $i < strlen($data); $i++) {
|
|
||||||
$data[$i] = $data[$i] ^ $mask[$i % 4];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -- BIP-340 Schnorr signature over secp256k1 --
|
|
||||||
|
|
||||||
private function getPublicKey(string $privateKeyHex): string
|
|
||||||
{
|
|
||||||
$d = gmp_init($privateKeyHex, 16);
|
|
||||||
$G = [gmp_init(self::SECP256K1_GX, 16), gmp_init(self::SECP256K1_GY, 16)];
|
|
||||||
|
|
||||||
$point = $this->ecMultiply($G, $d);
|
|
||||||
|
|
||||||
return str_pad(gmp_strval($point[0], 16), 64, '0', STR_PAD_LEFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function schnorrSign(string $messageHex, string $privateKeyHex): string
|
|
||||||
{
|
|
||||||
$p = gmp_init(self::SECP256K1_P, 16);
|
|
||||||
$n = gmp_init(self::SECP256K1_N, 16);
|
|
||||||
$G = [gmp_init(self::SECP256K1_GX, 16), gmp_init(self::SECP256K1_GY, 16)];
|
|
||||||
|
|
||||||
$d = gmp_init($privateKeyHex, 16);
|
|
||||||
$P = $this->ecMultiply($G, $d);
|
|
||||||
$px = str_pad(gmp_strval($P[0], 16), 64, '0', STR_PAD_LEFT);
|
|
||||||
|
|
||||||
// BIP-340: if P.y is odd, negate d
|
|
||||||
if (gmp_testbit($P[1], 0)) {
|
|
||||||
$d = gmp_sub($n, $d);
|
|
||||||
}
|
|
||||||
|
|
||||||
$dBytes = hex2bin(str_pad(gmp_strval($d, 16), 64, '0', STR_PAD_LEFT));
|
|
||||||
$auxRand = random_bytes(32);
|
|
||||||
$t = $dBytes ^ $this->taggedHash('BIP0340/aux', $auxRand);
|
|
||||||
$pxBytes = hex2bin($px);
|
|
||||||
$msgBytes = hex2bin($messageHex);
|
|
||||||
|
|
||||||
$rand = $this->taggedHash('BIP0340/nonce', $t . $pxBytes . $msgBytes);
|
|
||||||
$k0 = gmp_mod(gmp_init(bin2hex($rand), 16), $n);
|
|
||||||
|
|
||||||
if (gmp_cmp($k0, 0) === 0) {
|
|
||||||
return str_repeat('00', 64);
|
|
||||||
}
|
|
||||||
|
|
||||||
$R = $this->ecMultiply($G, $k0);
|
|
||||||
$k = gmp_testbit($R[1], 0) ? gmp_sub($n, $k0) : $k0;
|
|
||||||
|
|
||||||
$rx = str_pad(gmp_strval($R[0], 16), 64, '0', STR_PAD_LEFT);
|
|
||||||
$rxBytes = hex2bin($rx);
|
|
||||||
|
|
||||||
$eHash = $this->taggedHash('BIP0340/challenge', $rxBytes . $pxBytes . $msgBytes);
|
|
||||||
$e = gmp_mod(gmp_init(bin2hex($eHash), 16), $n);
|
|
||||||
|
|
||||||
$s = gmp_mod(gmp_add($k, gmp_mul($e, $d)), $n);
|
|
||||||
|
|
||||||
return $rx . str_pad(gmp_strval($s, 16), 64, '0', STR_PAD_LEFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function taggedHash(string $tag, string $data): string
|
|
||||||
{
|
|
||||||
$tagHash = hash('sha256', $tag, true);
|
|
||||||
|
|
||||||
return hash('sha256', $tagHash . $tagHash . $data, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -- secp256k1 elliptic curve arithmetic --
|
|
||||||
|
|
||||||
private function ecMultiply(array $point, \GMP $scalar): array
|
|
||||||
{
|
|
||||||
$result = null;
|
|
||||||
$addend = $point;
|
|
||||||
$n = gmp_init(self::SECP256K1_N, 16);
|
|
||||||
|
|
||||||
$scalar = gmp_mod($scalar, $n);
|
|
||||||
|
|
||||||
while (gmp_cmp($scalar, 0) > 0) {
|
|
||||||
if (gmp_testbit($scalar, 0)) {
|
|
||||||
$result = $result === null ? $addend : $this->ecAdd($result, $addend);
|
|
||||||
}
|
|
||||||
|
|
||||||
$addend = $this->ecDouble($addend);
|
|
||||||
$scalar = gmp_div_q($scalar, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function ecAdd(array $p1, array $p2): array
|
|
||||||
{
|
|
||||||
$prime = gmp_init(self::SECP256K1_P, 16);
|
|
||||||
|
|
||||||
if (gmp_cmp($p1[0], $p2[0]) === 0 && gmp_cmp($p1[1], $p2[1]) === 0) {
|
|
||||||
return $this->ecDouble($p1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$dx = gmp_mod(gmp_sub($p2[0], $p1[0]), $prime);
|
|
||||||
|
|
||||||
if (gmp_cmp($dx, 0) < 0) {
|
|
||||||
$dx = gmp_add($dx, $prime);
|
|
||||||
}
|
|
||||||
|
|
||||||
$dy = gmp_mod(gmp_sub($p2[1], $p1[1]), $prime);
|
|
||||||
|
|
||||||
if (gmp_cmp($dy, 0) < 0) {
|
|
||||||
$dy = gmp_add($dy, $prime);
|
|
||||||
}
|
|
||||||
|
|
||||||
$slope = gmp_mod(gmp_mul($dy, gmp_invert($dx, $prime)), $prime);
|
|
||||||
$x3 = gmp_mod(gmp_sub(gmp_sub(gmp_mul($slope, $slope), $p1[0]), $p2[0]), $prime);
|
|
||||||
$y3 = gmp_mod(gmp_sub(gmp_mul($slope, gmp_sub($p1[0], $x3)), $p1[1]), $prime);
|
|
||||||
|
|
||||||
if (gmp_cmp($x3, 0) < 0) {
|
|
||||||
$x3 = gmp_add($x3, $prime);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gmp_cmp($y3, 0) < 0) {
|
|
||||||
$y3 = gmp_add($y3, $prime);
|
|
||||||
}
|
|
||||||
|
|
||||||
return [$x3, $y3];
|
|
||||||
}
|
|
||||||
|
|
||||||
private function ecDouble(array $point): array
|
|
||||||
{
|
|
||||||
$prime = gmp_init(self::SECP256K1_P, 16);
|
|
||||||
|
|
||||||
// secp256k1 has a=0, so slope = 3*x^2 / (2*y)
|
|
||||||
$num = gmp_mod(gmp_mul(3, gmp_mul($point[0], $point[0])), $prime);
|
|
||||||
$denom = gmp_mod(gmp_mul(2, $point[1]), $prime);
|
|
||||||
|
|
||||||
if (gmp_cmp($denom, 0) < 0) {
|
|
||||||
$denom = gmp_add($denom, $prime);
|
|
||||||
}
|
|
||||||
|
|
||||||
$slope = gmp_mod(gmp_mul($num, gmp_invert($denom, $prime)), $prime);
|
|
||||||
$x3 = gmp_mod(gmp_sub(gmp_mul($slope, $slope), gmp_mul(2, $point[0])), $prime);
|
|
||||||
$y3 = gmp_mod(gmp_sub(gmp_mul($slope, gmp_sub($point[0], $x3)), $point[1]), $prime);
|
|
||||||
|
|
||||||
if (gmp_cmp($x3, 0) < 0) {
|
|
||||||
$x3 = gmp_add($x3, $prime);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gmp_cmp($y3, 0) < 0) {
|
|
||||||
$y3 = gmp_add($y3, $prime);
|
|
||||||
}
|
|
||||||
|
|
||||||
return [$x3, $y3];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Ntfy Push Notifications</name>
|
<name>MokoSuiteCross - Ntfy Push Notifications</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Pinterest</name>
|
<name>MokoSuiteCross - Pinterest</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Reddit</name>
|
<name>MokoSuiteCross - Reddit</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - RSS Feed</name>
|
<name>MokoSuiteCross - RSS Feed</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - SendGrid</name>
|
<name>MokoSuiteCross - SendGrid</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Slack</name>
|
<name>MokoSuiteCross - Slack</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Microsoft Teams</name>
|
<name>MokoSuiteCross - Microsoft Teams</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Telegram</name>
|
<name>MokoSuiteCross - Telegram</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
@@ -17,13 +17,15 @@ use Joomla\CMS\Plugin\CMSPlugin;
|
|||||||
use Joomla\Component\MokoSuiteCross\Administrator\Service\MokoSuiteCrossServiceInterface;
|
use Joomla\Component\MokoSuiteCross\Administrator\Service\MokoSuiteCrossServiceInterface;
|
||||||
use Joomla\Event\SubscriberInterface;
|
use Joomla\Event\SubscriberInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Threads (Meta) service plugin for MokoSuiteCross.
|
||||||
|
*
|
||||||
|
* Uses the Threads Publishing API — a 2-step flow:
|
||||||
|
* 1. Create a media container via POST /{user_id}/threads
|
||||||
|
* 2. Publish the container via POST /{user_id}/threads_publish
|
||||||
|
*/
|
||||||
class ThreadsService extends CMSPlugin implements SubscriberInterface, MokoSuiteCrossServiceInterface
|
class ThreadsService extends CMSPlugin implements SubscriberInterface, MokoSuiteCrossServiceInterface
|
||||||
{
|
{
|
||||||
private const API_BASE = 'https://graph.threads.net/v1.0/';
|
|
||||||
private const MAX_CAROUSEL_ITEMS = 20;
|
|
||||||
private const MAX_POLL_OPTIONS = 4;
|
|
||||||
private const MIN_POLL_OPTIONS = 2;
|
|
||||||
|
|
||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return ['onMokoSuiteCrossGetServices' => 'onMokoSuiteCrossGetServices'];
|
return ['onMokoSuiteCrossGetServices' => 'onMokoSuiteCrossGetServices'];
|
||||||
@@ -48,104 +50,25 @@ class ThreadsService extends CMSPlugin implements SubscriberInterface, MokoSuite
|
|||||||
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Missing access token or user ID.']];
|
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Missing access token or user ID.']];
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = mb_substr($message, 0, 500);
|
// Step 1: Create media container
|
||||||
$media = array_filter($media);
|
$containerUrl = 'https://graph.threads.net/v1.0/' . urlencode($userId) . '/threads';
|
||||||
|
|
||||||
if (\count($media) > 1) {
|
|
||||||
return $this->publishCarousel($text, $media, $userId, $token, $params);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->publishSinglePost($text, $media, $userId, $token, $params);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function publishSinglePost(string $text, array $media, string $userId, string $token, array $params): array
|
|
||||||
{
|
|
||||||
$containerUrl = self::API_BASE . urlencode($userId) . '/threads';
|
|
||||||
$containerData = [
|
$containerData = [
|
||||||
'text' => $text,
|
'text' => mb_substr($message, 0, 500),
|
||||||
'access_token' => $token,
|
'access_token' => $token,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Attach image if provided
|
||||||
if (!empty($media[0])) {
|
if (!empty($media[0])) {
|
||||||
$mediaType = $this->detectMediaType($media[0]);
|
$containerData['media_type'] = 'IMAGE';
|
||||||
$containerData['media_type'] = $mediaType;
|
$containerData['image_url'] = $media[0];
|
||||||
$containerData[$mediaType === 'VIDEO' ? 'video_url' : 'image_url'] = $media[0];
|
|
||||||
} else {
|
} else {
|
||||||
$containerData['media_type'] = 'TEXT';
|
$containerData['media_type'] = 'TEXT';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->applyPollOptions($containerData, $params);
|
$ch = curl_init($containerUrl);
|
||||||
$this->applySpoilerFlag($containerData, $params);
|
|
||||||
|
|
||||||
$result = $this->apiPost($containerUrl, $containerData);
|
|
||||||
|
|
||||||
if (!$result['success']) {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->publishContainer($userId, $token, $result['response']['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function publishCarousel(string $text, array $media, string $userId, string $token, array $params): array
|
|
||||||
{
|
|
||||||
$items = \array_slice($media, 0, self::MAX_CAROUSEL_ITEMS);
|
|
||||||
$childIds = [];
|
|
||||||
|
|
||||||
foreach ($items as $url) {
|
|
||||||
$mediaType = $this->detectMediaType($url);
|
|
||||||
$childData = [
|
|
||||||
'is_carousel_item' => 'true',
|
|
||||||
'media_type' => $mediaType,
|
|
||||||
'access_token' => $token,
|
|
||||||
];
|
|
||||||
$childData[$mediaType === 'VIDEO' ? 'video_url' : 'image_url'] = $url;
|
|
||||||
|
|
||||||
$childUrl = self::API_BASE . urlencode($userId) . '/threads';
|
|
||||||
$result = $this->apiPost($childUrl, $childData);
|
|
||||||
|
|
||||||
if (!$result['success']) {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
$childIds[] = $result['response']['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$carouselData = [
|
|
||||||
'media_type' => 'CAROUSEL',
|
|
||||||
'children' => implode(',', $childIds),
|
|
||||||
'text' => $text,
|
|
||||||
'access_token' => $token,
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->applySpoilerFlag($carouselData, $params);
|
|
||||||
|
|
||||||
$carouselUrl = self::API_BASE . urlencode($userId) . '/threads';
|
|
||||||
$result = $this->apiPost($carouselUrl, $carouselData);
|
|
||||||
|
|
||||||
if (!$result['success']) {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->publishContainer($userId, $token, $result['response']['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function publishContainer(string $userId, string $token, string $containerId): array
|
|
||||||
{
|
|
||||||
$publishUrl = self::API_BASE . urlencode($userId) . '/threads_publish';
|
|
||||||
$publishData = [
|
|
||||||
'creation_id' => $containerId,
|
|
||||||
'access_token' => $token,
|
|
||||||
];
|
|
||||||
|
|
||||||
return $this->apiPost($publishUrl, $publishData);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function apiPost(string $url, array $data): array
|
|
||||||
{
|
|
||||||
$ch = curl_init($url);
|
|
||||||
curl_setopt_array($ch, [
|
curl_setopt_array($ch, [
|
||||||
CURLOPT_POST => true,
|
CURLOPT_POST => true,
|
||||||
CURLOPT_POSTFIELDS => http_build_query($data),
|
CURLOPT_POSTFIELDS => http_build_query($containerData),
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_TIMEOUT => 30,
|
CURLOPT_TIMEOUT => 30,
|
||||||
]);
|
]);
|
||||||
@@ -153,60 +76,61 @@ class ThreadsService extends CMSPlugin implements SubscriberInterface, MokoSuite
|
|||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
if ($response === false) {
|
if ($response === false) {
|
||||||
|
|
||||||
$curlError = curl_error($ch);
|
$curlError = curl_error($ch);
|
||||||
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Connection error: ' . $curlError]];
|
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Connection error: ' . $curlError]];
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
$responseData = json_decode($response, true) ?: [];
|
$data = json_decode($response, true) ?: [];
|
||||||
|
|
||||||
if ($httpCode >= 200 && $httpCode < 300 && !empty($responseData['id'])) {
|
if ($httpCode < 200 || $httpCode >= 300 || empty($data['id'])) {
|
||||||
return ['success' => true, 'platform_post_id' => (string) $responseData['id'], 'response' => $responseData];
|
return ['success' => false, 'platform_post_id' => '', 'response' => $data];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['success' => false, 'platform_post_id' => '', 'response' => $responseData];
|
$containerId = $data['id'];
|
||||||
}
|
|
||||||
|
|
||||||
private function applyPollOptions(array &$data, array $params): void
|
// Step 2: Publish the container
|
||||||
{
|
$publishUrl = 'https://graph.threads.net/v1.0/' . urlencode($userId) . '/threads_publish';
|
||||||
$options = $params['poll_options'] ?? [];
|
$publishData = [
|
||||||
|
'creation_id' => $containerId,
|
||||||
|
'access_token' => $token,
|
||||||
|
];
|
||||||
|
|
||||||
if (empty($options) || !\is_array($options)) {
|
$ch = curl_init($publishUrl);
|
||||||
return;
|
curl_setopt_array($ch, [
|
||||||
|
CURLOPT_POST => true,
|
||||||
|
CURLOPT_POSTFIELDS => http_build_query($publishData),
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_TIMEOUT => 30,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
|
||||||
|
$curlError = curl_error($ch);
|
||||||
|
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
return ['success' => false, 'platform_post_id' => '', 'response' => ['error' => 'Connection error: ' . $curlError]];
|
||||||
|
|
||||||
|
}
|
||||||
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$data = json_decode($response, true) ?: [];
|
||||||
|
|
||||||
|
if ($httpCode >= 200 && $httpCode < 300 && !empty($data['id'])) {
|
||||||
|
return ['success' => true, 'platform_post_id' => (string) $data['id'], 'response' => $data];
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = \array_slice($options, 0, self::MAX_POLL_OPTIONS);
|
return ['success' => false, 'platform_post_id' => '', 'response' => $data];
|
||||||
|
|
||||||
if (\count($options) < self::MIN_POLL_OPTIONS) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['poll'] = json_encode(['options' => array_values($options)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function applySpoilerFlag(array &$data, array $params): void
|
|
||||||
{
|
|
||||||
if (!empty($params['spoiler'])) {
|
|
||||||
$data['spoiler'] = 'true';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function detectMediaType(string $url): string
|
|
||||||
{
|
|
||||||
$path = strtolower(parse_url($url, PHP_URL_PATH) ?? '');
|
|
||||||
$videoExtensions = ['.mp4', '.mov', '.avi', '.wmv', '.webm'];
|
|
||||||
|
|
||||||
foreach ($videoExtensions as $ext) {
|
|
||||||
if (str_ends_with($path, $ext)) {
|
|
||||||
return 'VIDEO';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'IMAGE';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateCredentials(array $credentials): array
|
public function validateCredentials(array $credentials): array
|
||||||
@@ -218,7 +142,7 @@ class ThreadsService extends CMSPlugin implements SubscriberInterface, MokoSuite
|
|||||||
return ['valid' => false, 'message' => 'Access token and user ID are required.', 'account_name' => ''];
|
return ['valid' => false, 'message' => 'Access token and user ID are required.', 'account_name' => ''];
|
||||||
}
|
}
|
||||||
|
|
||||||
$ch = curl_init(self::API_BASE . urlencode($userId) . '?fields=username&access_token=' . urlencode($token));
|
$ch = curl_init('https://graph.threads.net/v1.0/' . urlencode($userId) . '?fields=username&access_token=' . urlencode($token));
|
||||||
curl_setopt_array($ch, [
|
curl_setopt_array($ch, [
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_TIMEOUT => 10,
|
CURLOPT_TIMEOUT => 10,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
<extension type="plugin" group="mokosuitecross" method="upgrade">
|
||||||
<name>MokoSuiteCross - Threads (Meta)</name>
|
<name>MokoSuiteCross - Threads (Meta)</name>
|
||||||
<version>01.08.37</version>
|
<version>01.08.00</version>
|
||||||
<creationDate>2026-05-28</creationDate>
|
<creationDate>2026-05-28</creationDate>
|
||||||
<author>Moko Consulting</author>
|
<author>Moko Consulting</author>
|
||||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user