This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magento_Catalog::catalog">
<resource id="Esun_Video::videos" title="Esun Video Management" sortOrder="85">
<resource id="Esun_Video::upload" title="Upload Videos" sortOrder="10"/>
<resource id="Esun_Video::edit" title="Edit Videos" sortOrder="20"/>
<resource id="Esun_Video::delete" title="Delete Videos" sortOrder="30"/>
</resource>
</resource>
<resource id="Magento_Backend::stores">
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource id="Esun_Video::config" title="Esun Video Configuration" sortOrder="85"/>
</resource>
</resource>
</resource>
</resource>
</resources>
</acl>
</config>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Esun_Video::videos" title="Video Management" module="Esun_Video"
sortOrder="20" parent="Esun_ImageManager::esun"
action="esun_video/video/index" resource="Esun_Video::videos"/>
</menu>
</config>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="esun_video" frontName="esun_video">
<module name="Esun_Video" before="Magento_Backend"/>
</route>
</router>
</config>
@@ -0,0 +1,112 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="esun" translate="label" sortOrder="300">
<label>Esun</label>
</tab>
<section id="esun_video" translate="label" type="text" sortOrder="920"
showInDefault="1" showInWebsite="1" showInStore="0">
<label>Video Management</label>
<tab>esun</tab>
<resource>Esun_Video::config</resource>
<group id="general" translate="label" type="text" sortOrder="10"
showInDefault="1" showInWebsite="1" showInStore="0">
<label>Upload Configuration</label>
<field id="enabled" translate="label" type="select" sortOrder="10"
showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enable Video Upload</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="media_path" translate="label comment" type="text" sortOrder="30"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Media Base Path</label>
<comment>Relative to pub/media. Example: esun/video</comment>
<validate>required-entry</validate>
</field>
<field id="chunk_size" translate="label comment" type="text" sortOrder="40"
showInDefault="1" showInWebsite="1" showInStore="0">
<label>Chunk Size (MB)</label>
<comment>Browser upload chunk size. Recommended: 5-50 MB.</comment>
<validate>required-entry validate-number validate-greater-than-zero</validate>
</field>
<field id="ffmpeg_binary" translate="label comment" type="text" sortOrder="50"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>ffmpeg Binary</label>
<comment>Used to generate a cover image from the video at the 1-second mark.</comment>
<validate>required-entry</validate>
</field>
<field id="ffprobe_binary" translate="label comment" type="text" sortOrder="60"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>ffprobe Binary</label>
<comment>Binary name or absolute path available to the PHP process.</comment>
<validate>required-entry</validate>
</field>
</group>
<group id="storage" translate="label" type="text" sortOrder="20"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Media Storage</label>
<comment>Changes are written to app/etc/env.php and take effect on the next request.</comment>
<field id="driver" translate="label comment" type="select" sortOrder="10"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Storage Driver</label>
<comment>Local stores files in pub/media. AWS S3 uses Magento RemoteStorage.</comment>
<source_model>Esun\Video\Model\Config\Source\StorageDriver</source_model>
<backend_model>Esun\Video\Model\Config\Backend\RemoteStorage</backend_model>
</field>
<field id="bucket" translate="label" type="text" sortOrder="20"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>S3 Bucket</label>
<backend_model>Esun\Video\Model\Config\Backend\RemoteStorage</backend_model>
<depends><field id="driver">aws-s3</field></depends>
</field>
<field id="region" translate="label" type="text" sortOrder="30"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>AWS Region</label>
<backend_model>Esun\Video\Model\Config\Backend\RemoteStorage</backend_model>
<depends><field id="driver">aws-s3</field></depends>
</field>
<field id="prefix" translate="label comment" type="text" sortOrder="40"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>S3 Prefix</label>
<comment>Optional directory prefix inside the bucket, for example production/media.</comment>
<backend_model>Esun\Video\Model\Config\Backend\RemoteStorage</backend_model>
<depends><field id="driver">aws-s3</field></depends>
</field>
<field id="endpoint" translate="label comment" type="text" sortOrder="50"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>S3 Endpoint</label>
<comment>Leave empty for AWS. Set this for an S3-compatible service.</comment>
<backend_model>Esun\Video\Model\Config\Backend\RemoteStorage</backend_model>
<depends><field id="driver">aws-s3</field></depends>
</field>
<field id="access_key" translate="label comment" type="obscure" sortOrder="60"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Access Key</label>
<comment>Leave both credentials empty to use an IAM role or the AWS credential provider chain.</comment>
<backend_model>Esun\Video\Model\Config\Backend\RemoteStorageEncrypted</backend_model>
<depends><field id="driver">aws-s3</field></depends>
</field>
<field id="secret_key" translate="label" type="obscure" sortOrder="70"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Secret Key</label>
<backend_model>Esun\Video\Model\Config\Backend\RemoteStorageEncrypted</backend_model>
<depends><field id="driver">aws-s3</field></depends>
</field>
<field id="path_style" translate="label comment" type="select" sortOrder="80"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Use Path-Style Endpoint</label>
<comment>Usually disabled for AWS. Some S3-compatible services require it.</comment>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<backend_model>Esun\Video\Model\Config\Backend\RemoteStorage</backend_model>
<depends><field id="driver">aws-s3</field></depends>
</field>
<field id="sync_note" translate="label comment" type="label" sortOrder="90"
showInDefault="1" showInWebsite="0" showInStore="0">
<label>Existing Media</label>
<comment>After switching to AWS S3, run: php bin/magento remote-storage:sync. Before switching back to local, restore the S3 files into pub/media.</comment>
</field>
</group>
</section>
</system>
</config>
+25
View File
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<esun_video>
<general>
<enabled>1</enabled>
<media_path>esun/video</media_path>
<chunk_size>10</chunk_size>
<ffmpeg_binary>ffmpeg</ffmpeg_binary>
<ffprobe_binary>ffprobe</ffprobe_binary>
</general>
<storage>
<driver>file</driver>
<prefix></prefix>
<endpoint></endpoint>
<bucket></bucket>
<region></region>
<access_key></access_key>
<secret_key></secret_key>
<path_style>0</path_style>
</storage>
</esun_video>
</default>
</config>
+27
View File
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="esun_video" resource="default" engine="innodb" comment="Esun Uploaded Videos">
<column xsi:type="int" name="video_id" unsigned="true" nullable="false" identity="true" comment="Video ID"/>
<column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
<column xsi:type="text" name="description" nullable="true" comment="Description"/>
<column xsi:type="varchar" name="video_path" nullable="false" length="1024" comment="Media Relative Video Path"/>
<column xsi:type="varchar" name="cover_path" nullable="true" length="1024" comment="Media Relative Cover Path"/>
<column xsi:type="smallint" name="status" unsigned="true" nullable="false" default="1" comment="Status"/>
<column xsi:type="decimal" name="duration" scale="3" precision="12" nullable="false" default="0" comment="Duration Seconds"/>
<column xsi:type="bigint" name="size" unsigned="true" nullable="false" default="0" comment="File Size Bytes"/>
<column xsi:type="int" name="width" unsigned="true" nullable="false" default="0" comment="Width"/>
<column xsi:type="int" name="height" unsigned="true" nullable="false" default="0" comment="Height"/>
<column xsi:type="varchar" name="resolution" nullable="false" length="32" default="" comment="Resolution Label"/>
<column xsi:type="varchar" name="original_name" nullable="false" length="255" comment="Original File Name"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At"/>
<column xsi:type="timestamp" name="updated_at" nullable="false" default="CURRENT_TIMESTAMP"
on_update="true" comment="Updated At"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="video_id"/>
</constraint>
<index referenceId="ESUN_VIDEO_STATUS" indexType="btree">
<column name="status"/>
</index>
</table>
</schema>
@@ -0,0 +1,26 @@
{
"esun_video": {
"column": {
"video_id": true,
"title": true,
"description": true,
"video_path": true,
"cover_path": true,
"status": true,
"duration": true,
"size": true,
"width": true,
"height": true,
"resolution": true,
"original_name": true,
"created_at": true,
"updated_at": true
},
"constraint": {
"PRIMARY": true
},
"index": {
"ESUN_VIDEO_STATUS": true
}
}
}
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Esun_Video">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_ProductVideo"/>
<module name="Magento_RemoteStorage"/>
<module name="Esun_ImageManager"/>
</sequence>
</module>
</config>