mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-25 01:33:51 +02:00
Upload prints
This commit is contained in:
@@ -304,9 +304,8 @@ namespace VRCX
|
|||||||
var boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
|
var boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
|
||||||
request.ContentType = "multipart/form-data; boundary=" + boundary;
|
request.ContentType = "multipart/form-data; boundary=" + boundary;
|
||||||
var requestStream = request.GetRequestStream();
|
var requestStream = request.GetRequestStream();
|
||||||
// var requestStream = new MemoryStream();
|
|
||||||
var imageData = options["imageData"] as string;
|
var imageData = options["imageData"] as string;
|
||||||
var fileToUpload = Convert.FromBase64String(imageData);
|
var fileToUpload = AppApi.Instance.ResizeImageToFitLimits(Convert.FromBase64String(imageData), 1920, 1080);
|
||||||
const string fileFormKey = "image";
|
const string fileFormKey = "image";
|
||||||
const string fileName = "image";
|
const string fileName = "image";
|
||||||
const string fileMimeType = "image/png";
|
const string fileMimeType = "image/png";
|
||||||
@@ -315,6 +314,8 @@ namespace VRCX
|
|||||||
var header = string.Format(headerTemplate, boundary, fileFormKey, fileName, fileMimeType, fileSize);
|
var header = string.Format(headerTemplate, boundary, fileFormKey, fileName, fileMimeType, fileSize);
|
||||||
var headerBytes = Encoding.UTF8.GetBytes(header);
|
var headerBytes = Encoding.UTF8.GetBytes(header);
|
||||||
await requestStream.WriteAsync(headerBytes);
|
await requestStream.WriteAsync(headerBytes);
|
||||||
|
var newlineBytes = Encoding.UTF8.GetBytes("\r\n");
|
||||||
|
await requestStream.WriteAsync(newlineBytes);
|
||||||
using (var fileStream = new MemoryStream(fileToUpload))
|
using (var fileStream = new MemoryStream(fileToUpload))
|
||||||
{
|
{
|
||||||
var buffer = new byte[1024];
|
var buffer = new byte[1024];
|
||||||
@@ -325,10 +326,9 @@ namespace VRCX
|
|||||||
}
|
}
|
||||||
fileStream.Close();
|
fileStream.Close();
|
||||||
}
|
}
|
||||||
var newlineBytes = Encoding.UTF8.GetBytes("\r\n");
|
|
||||||
await requestStream.WriteAsync(newlineBytes);
|
|
||||||
const string textContentType = "text/plain; charset=utf-8";
|
const string textContentType = "text/plain; charset=utf-8";
|
||||||
const string formDataTemplate = "--{0}\r\nContent-Disposition: form-data; name=\"{1}\"\r\nContent-Type: {2}\r\nContent-Length: {3}\r\n{4}\r\n";
|
const string formDataTemplate = "--{0}\r\nContent-Disposition: form-data; name=\"{1}\"\r\nContent-Type: {2}\r\nContent-Length: {3}\r\n\r\n{4}\r\n";
|
||||||
|
await requestStream.WriteAsync(newlineBytes);
|
||||||
if (options.TryGetValue("postData", out var postDataObject))
|
if (options.TryGetValue("postData", out var postDataObject))
|
||||||
{
|
{
|
||||||
var jsonPostData = JsonConvert.DeserializeObject<Dictionary<string, string>>(postDataObject.ToString());
|
var jsonPostData = JsonConvert.DeserializeObject<Dictionary<string, string>>(postDataObject.ToString());
|
||||||
@@ -344,13 +344,7 @@ namespace VRCX
|
|||||||
}
|
}
|
||||||
var endBytes = Encoding.UTF8.GetBytes("--" + boundary + "--");
|
var endBytes = Encoding.UTF8.GetBytes("--" + boundary + "--");
|
||||||
await requestStream.WriteAsync(endBytes);
|
await requestStream.WriteAsync(endBytes);
|
||||||
// test file
|
|
||||||
// var newFileStream = new FileStream(@"D:\WindowsFiles\Desktop\test", FileMode.Create, FileAccess.Write);
|
|
||||||
// requestStream.WriteTo(newFileStream);
|
|
||||||
// newFileStream.Close();
|
|
||||||
|
|
||||||
requestStream.Close();
|
requestStream.Close();
|
||||||
// throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable CS4014
|
#pragma warning disable CS4014
|
||||||
|
|||||||
@@ -17505,7 +17505,7 @@ speechSynthesis.getVoices();
|
|||||||
};
|
};
|
||||||
|
|
||||||
API.$on('PRINT:LIST', function (args) {
|
API.$on('PRINT:LIST', function (args) {
|
||||||
$app.printTable = args.json.reverse();
|
$app.printTable = args.json;
|
||||||
$app.galleryDialogPrintsLoading = false;
|
$app.galleryDialogPrintsLoading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -17524,6 +17524,8 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$app.data.printUploadNote = '';
|
||||||
|
|
||||||
$app.methods.onFileChangePrint = function (e) {
|
$app.methods.onFileChangePrint = function (e) {
|
||||||
var clearFile = function () {
|
var clearFile = function () {
|
||||||
if (document.querySelector('#PrintUploadButton')) {
|
if (document.querySelector('#PrintUploadButton')) {
|
||||||
@@ -17556,8 +17558,8 @@ speechSynthesis.getVoices();
|
|||||||
var date = new Date();
|
var date = new Date();
|
||||||
var timestamp = date.toISOString().slice(0, 19);
|
var timestamp = date.toISOString().slice(0, 19);
|
||||||
var params = {
|
var params = {
|
||||||
note: 'test print',
|
note: $app.printUploadNote,
|
||||||
worldId: 'wrld_10e5e467-fc65-42ed-8957-f02cace1398c',
|
// worldId: '',
|
||||||
timestamp
|
timestamp
|
||||||
};
|
};
|
||||||
var base64Body = btoa(r.result);
|
var base64Body = btoa(r.result);
|
||||||
|
|||||||
@@ -1270,7 +1270,7 @@
|
|||||||
},
|
},
|
||||||
"gallery_icons": {
|
"gallery_icons": {
|
||||||
"header": "Manage Photos, Icons, Emojis and Stickers",
|
"header": "Manage Photos, Icons, Emojis and Stickers",
|
||||||
"description": "Recommended image size: 1200x900px (4:3)",
|
"recommended_image_size": "Recommended image size",
|
||||||
"gallery": "Photos",
|
"gallery": "Photos",
|
||||||
"icons": "Icons",
|
"icons": "Icons",
|
||||||
"emojis": "Emojis",
|
"emojis": "Emojis",
|
||||||
@@ -1284,7 +1284,8 @@
|
|||||||
"emoji_animation_fps": "FPS:",
|
"emoji_animation_fps": "FPS:",
|
||||||
"emoji_animation_frame_count": "Frame Count:",
|
"emoji_animation_frame_count": "Frame Count:",
|
||||||
"emoji_loop_pingpong": "Loop PingPong",
|
"emoji_loop_pingpong": "Loop PingPong",
|
||||||
"flipbook_info": "Select a 1024x1024 PNG spritesheet to use as an animated emoji, available frame grid sizes: 4, 16 or 64 (max FPS 64, max frames 64)"
|
"flipbook_info": "Select a 1024x1024 PNG spritesheet to use as an animated emoji, available frame grid sizes: 4, 16 or 64 (max FPS 64, max frames 64)",
|
||||||
|
"note": "Note"
|
||||||
},
|
},
|
||||||
"change_content_image": {
|
"change_content_image": {
|
||||||
"avatar": "Change Avatar Image",
|
"avatar": "Change Avatar Image",
|
||||||
|
|||||||
@@ -61,14 +61,14 @@ mixin currentUser()
|
|||||||
|
|
||||||
//- dialog: Gallery/VRCPlusIcons
|
//- dialog: Gallery/VRCPlusIcons
|
||||||
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="galleryDialog" :visible.sync="galleryDialogVisible" :title="$t('dialog.gallery_icons.header')" width="100%")
|
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="galleryDialog" :visible.sync="galleryDialogVisible" :title="$t('dialog.gallery_icons.header')" width="100%")
|
||||||
span(style="padding-bottom:10px") {{ $t('dialog.gallery_icons.description') }}
|
|
||||||
br
|
|
||||||
br
|
|
||||||
el-tabs(type="card" ref="galleryTabs")
|
el-tabs(type="card" ref="galleryTabs")
|
||||||
el-tab-pane(v-if="galleryDialogVisible" v-loading="galleryDialogGalleryLoading")
|
el-tab-pane(v-if="galleryDialogVisible" v-loading="galleryDialogGalleryLoading")
|
||||||
span(slot="label") {{ $t('dialog.gallery_icons.gallery') }}
|
span(slot="label") {{ $t('dialog.gallery_icons.gallery') }}
|
||||||
span(style="color:#909399;font-size:12px;margin-left:5px") {{ galleryTable.length }}/64
|
span(style="color:#909399;font-size:12px;margin-left:5px") {{ galleryTable.length }}/64
|
||||||
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangeGallery" id="GalleryUploadButton" style="display:none")
|
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangeGallery" id="GalleryUploadButton" style="display:none")
|
||||||
|
span {{ $t('dialog.gallery_icons.recommended_image_size') }}: 1200x900px (4:3)
|
||||||
|
br
|
||||||
|
br
|
||||||
el-button-group
|
el-button-group
|
||||||
el-button(type="default" size="small" @click="refreshGalleryTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
el-button(type="default" size="small" @click="refreshGalleryTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
||||||
el-button(type="default" size="small" @click="displayGalleryUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
el-button(type="default" size="small" @click="displayGalleryUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
||||||
@@ -84,6 +84,9 @@ mixin currentUser()
|
|||||||
span(slot="label") {{ $t('dialog.gallery_icons.icons') }}
|
span(slot="label") {{ $t('dialog.gallery_icons.icons') }}
|
||||||
span(style="color:#909399;font-size:12px;margin-left:5px") {{ VRCPlusIconsTable.length }}/64
|
span(style="color:#909399;font-size:12px;margin-left:5px") {{ VRCPlusIconsTable.length }}/64
|
||||||
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangeVRCPlusIcon" id="VRCPlusIconUploadButton" style="display:none")
|
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangeVRCPlusIcon" id="VRCPlusIconUploadButton" style="display:none")
|
||||||
|
span {{ $t('dialog.gallery_icons.recommended_image_size') }}: 1200x900px (4:3)
|
||||||
|
br
|
||||||
|
br
|
||||||
el-button-group
|
el-button-group
|
||||||
el-button(type="default" size="small" @click="refreshVRCPlusIconsTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
el-button(type="default" size="small" @click="refreshVRCPlusIconsTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
||||||
el-button(type="default" size="small" @click="displayVRCPlusIconUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
el-button(type="default" size="small" @click="displayVRCPlusIconUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
||||||
@@ -99,6 +102,9 @@ mixin currentUser()
|
|||||||
span(slot="label") {{ $t('dialog.gallery_icons.emojis') }}
|
span(slot="label") {{ $t('dialog.gallery_icons.emojis') }}
|
||||||
span(style="color:#909399;font-size:12px;margin-left:5px") {{ emojiTable.length }}/9
|
span(style="color:#909399;font-size:12px;margin-left:5px") {{ emojiTable.length }}/9
|
||||||
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangeEmoji" id="EmojiUploadButton" style="display:none")
|
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangeEmoji" id="EmojiUploadButton" style="display:none")
|
||||||
|
span {{ $t('dialog.gallery_icons.recommended_image_size') }}: 1200x900px (4:3)
|
||||||
|
br
|
||||||
|
br
|
||||||
el-button-group(style="margin-right:10px")
|
el-button-group(style="margin-right:10px")
|
||||||
el-button(type="default" size="small" @click="refreshEmojiTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
el-button(type="default" size="small" @click="refreshEmojiTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
||||||
el-button(type="default" size="small" @click="displayEmojiUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
el-button(type="default" size="small" @click="displayEmojiUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
||||||
@@ -140,6 +146,9 @@ mixin currentUser()
|
|||||||
span(slot="label") {{ $t('dialog.gallery_icons.stickers') }}
|
span(slot="label") {{ $t('dialog.gallery_icons.stickers') }}
|
||||||
span(style="color:#909399;font-size:12px;margin-left:5px") {{ stickerTable.length }}/9
|
span(style="color:#909399;font-size:12px;margin-left:5px") {{ stickerTable.length }}/9
|
||||||
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangeSticker" id="StickerUploadButton" style="display:none")
|
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangeSticker" id="StickerUploadButton" style="display:none")
|
||||||
|
span {{ $t('dialog.gallery_icons.recommended_image_size') }}: 1200x900px (4:3)
|
||||||
|
br
|
||||||
|
br
|
||||||
el-button-group
|
el-button-group
|
||||||
el-button(type="default" size="small" @click="refreshStickerTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
el-button(type="default" size="small" @click="refreshStickerTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
||||||
el-button(type="default" size="small" @click="displayStickerUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
el-button(type="default" size="small" @click="displayStickerUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
||||||
@@ -154,9 +163,13 @@ mixin currentUser()
|
|||||||
span(slot="label") {{ $t('dialog.gallery_icons.prints') }}
|
span(slot="label") {{ $t('dialog.gallery_icons.prints') }}
|
||||||
span(style="color:#909399;font-size:12px;margin-left:5px") {{ printTable.length }}/64
|
span(style="color:#909399;font-size:12px;margin-left:5px") {{ printTable.length }}/64
|
||||||
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangePrint" id="PrintUploadButton" style="display:none")
|
input(type="file" accept="image/png,image/jpg,image/jpeg,image/webp,image/bmp,image/gif" @change="onFileChangePrint" id="PrintUploadButton" style="display:none")
|
||||||
|
span {{ $t('dialog.gallery_icons.recommended_image_size') }}: 1920x1080px (16:9)
|
||||||
|
br
|
||||||
|
br
|
||||||
el-button-group
|
el-button-group
|
||||||
el-button(type="default" size="small" @click="refreshPrintTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
el-button(type="default" size="small" @click="refreshPrintTable" icon="el-icon-refresh") {{ $t('dialog.gallery_icons.refresh') }}
|
||||||
//- el-button(type="default" size="small" @click="displayPrintUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
el-button(type="default" size="small" @click="displayPrintUpload" icon="el-icon-upload2" :disabled="!API.currentUser.$isVRCPlus") {{ $t('dialog.gallery_icons.upload') }}
|
||||||
|
el-input(type="textarea" v-model="printUploadNote" size="mini" rows="1" resize="none" maxlength="32" style="margin-left:10px;width:300px" :placeholder="$t('dialog.gallery_icons.note')")
|
||||||
br
|
br
|
||||||
.x-friend-item(v-for="image in printTable" :key="image.id" style="display:inline-block;margin-top:10px;width:unset;cursor:default")
|
.x-friend-item(v-for="image in printTable" :key="image.id" style="display:inline-block;margin-top:10px;width:unset;cursor:default")
|
||||||
.vrcplus-icon(style="overflow:hidden" @click="showFullscreenImageDialog(image.files.image)")
|
.vrcplus-icon(style="overflow:hidden" @click="showFullscreenImageDialog(image.files.image)")
|
||||||
@@ -168,6 +181,8 @@ mixin currentUser()
|
|||||||
span(v-else style="display:block")
|
span(v-else style="display:block")
|
||||||
display-name.x-ellipsis(v-if="image.authorId" :userid="image.authorId" :hint="image.authorName" style="color:#909399;font-family:monospace;display:block")
|
display-name.x-ellipsis(v-if="image.authorId" :userid="image.authorId" :hint="image.authorName" style="color:#909399;font-family:monospace;display:block")
|
||||||
span(v-else style="font-family:monospace;display:block")
|
span(v-else style="font-family:monospace;display:block")
|
||||||
|
span.x-ellipsis(v-if="image.timestamp" style="color:#909399;font-family:monospace;font-size:11px;display:block") {{ image.timestamp | formatDate('long') }}
|
||||||
|
span(v-else style="display:block")
|
||||||
div(style="float:right")
|
div(style="float:right")
|
||||||
el-button(type="default" @click="showFullscreenImageDialog(image.files.image)" size="mini" icon="el-icon-picture-outline" circle)
|
el-button(type="default" @click="showFullscreenImageDialog(image.files.image)" size="mini" icon="el-icon-picture-outline" circle)
|
||||||
el-button(type="default" @click="deletePrint(image.id)" size="mini" icon="el-icon-delete" circle style="margin-left:5px")
|
el-button(type="default" @click="deletePrint(image.id)" size="mini" icon="el-icon-delete" circle style="margin-left:5px")
|
||||||
|
|||||||
Reference in New Issue
Block a user