Skip to content

Commit

Permalink
Merge pull request #93 from inovector/develop
Browse files Browse the repository at this point in the history
fix calendar timezone, support s3 for x, changed doc url
  • Loading branch information
lao9s authored May 9, 2024
2 parents ec6725e + 4632757 commit 4e21160
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"require": {
"php": "^8.1",
"ext-fileinfo": "*",
"abraham/twitteroauth": "^4.0",
"guzzlehttp/guzzle": "^7.5",
"illuminate/contracts": "^9.28|^10.0",
"inertiajs/inertia-laravel": "^0.6.9",
"inovector/twitteroauth": "^7.0",
"intervention/image": "^2.7",
"php-ffmpeg/php-ffmpeg": "^1.0",
"spatie/laravel-package-tools": "^1.14",
Expand Down
18 changes: 10 additions & 8 deletions resources/js/Components/Calendar/Month/CalendarMonth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const props = defineProps({
const emit = defineEmits(['dateSelected'])
const selectedDate = ref(new Date(props.initialDate));
const selectedDate = ref(new Date(`${props.initialDate}T00:00:00`));
const days = computed(() => {
return [
Expand Down Expand Up @@ -81,26 +81,26 @@ const previousMonthDays = computed(() => {
? firstDayOfTheMonthWeekday - props.weekStartsOn
: props.weekStartsOn ? 6 : 0;
const previousMonthLastMondayDayOfMonth = getDate(subDays(new Date(currentMonthDays.value[0].date), visibleNumberOfDaysFromPreviousMonth))
const previousMonthLastMondayDayOfMonth = getDate(subDays(new Date(`${currentMonthDays.value[0].date}T00:00:00`), visibleNumberOfDaysFromPreviousMonth))
const previousMonth = subMonths(selectedDate.value, 1);
return [...Array(visibleNumberOfDaysFromPreviousMonth)].map(
(day, index) => {
const date = new Date(`${getYear(previousMonth)}-${(getMonth(previousMonth) + 1).toString().padStart(2, '0')}-${(previousMonthLastMondayDayOfMonth + index).toString().padStart(2, '0')}`);
const date = new Date(`${getYear(previousMonth)}-${(getMonth(previousMonth) + 1).toString().padStart(2, '0')}-${(previousMonthLastMondayDayOfMonth + index).toString().padStart(2, '0')}T00:00:00`);
return {
date: format(date, 'yyyy-MM-dd'),
isDisabled: isDatePast(date, props.timeZone),
posts: []
posts: getDayPosts(date)
};
}
);
})
const currentMonthDays = computed(() => {
return [...Array(numberOfDaysInMonth.value)].map((day, index) => {
const date = new Date(`${year.value}-${month.value}-${(index + 1).toString().padStart(2, '0')}`);
const date = new Date(`${year.value}-${month.value}-${(index + 1).toString().padStart(2, '0')}T00:00:00`);
return {
date: format(date, 'yyyy-MM-dd'),
Expand All @@ -120,16 +120,18 @@ const nextMonthDays = computed(() => {
const nextMonth = addMonths(selectedDate.value, 1);
return [...Array(visibleNumberOfDaysFromNextMonth)].map((day, index) => {
const date = new Date(`${getYear(nextMonth)}-${(getMonth(nextMonth) + 1).toString().padStart(2, '0')}-${(index + 1).toString().padStart(2, '0')}T00:00:00`);
return {
date: format(new Date(`${getYear(nextMonth)}-${(getMonth(nextMonth) + 1).toString().padStart(2, '0')}-${(index + 1).toString().padStart(2, '0')}`), 'yyyy-MM-dd'),
date: format(date, 'yyyy-MM-dd'),
isDisabled: false,
posts: []
posts: getDayPosts(date)
};
});
})
const getWeekday = (date) => {
return getDay(typeof date === 'string' ? new Date(date) : date);
return getDay(typeof date === 'string' ? new Date(`${date}T00:00:00`) : date);
}
const getDayPosts = (date) => {
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Components/Calendar/Month/MonthDayItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const props = defineProps({
})
const label = computed(() => {
return format(new Date(props.day.date), 'd');
return format(new Date(`${props.day.date}T00:00:00`), 'd');
})
const style = computed(() => {
Expand All @@ -40,7 +40,7 @@ const style = computed(() => {
const add = () => {
const now = utcToZonedTime(new Date().toISOString(), props.timeZone);
let scheduleAt = `${props.day.date} ${format(now, 'H:mm')}`;
let scheduleAt = `${props.day.date} ${format(now, 'HH:mm')}`;
router.visit(route('mixpost.posts.create', {schedule_at: scheduleAt}));
}
Expand Down
7 changes: 5 additions & 2 deletions resources/js/Components/Media/MediaFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ const imgHeightClass = computed(() => {
<div v-if="media.hasOwnProperty('error')" class="text-center">
<ExclamationCircleIcon class="w-8 h-8 mx-auto text-red-500"/>
<div class="mt-xs">{{ media.name }}</div>
<div class="mt-xs text-red-500">{{ media.error ? media.error : 'Error uploading file!' }}</div>
<div class="mt-xs text-red-500">{{
media.error ? media.error : $t('media.error_uploading_media')
}}
</div>
</div>

<img
:src="media.thumb_url"
loading="lazy"
alt="Image"
class="w-full rounded-md"
class="rounded-md"
:class="[imgHeightClass, {'w-full': imgWidthFull}]"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const save = () => {
<a href="https://developers.facebook.com/apps" class="link" target="_blank">Create an App on
Facebook</a>.
</p>
<ReadDocHelp :href="`${$page.props.mixpost.docs_link}/books/services-configuration-mixpost/page/facebook`" class="mt-xs"/>
<ReadDocHelp :href="`${$page.props.mixpost.docs_link}/services/social/facebook/`" class="mt-xs"/>
</template>

<HorizontalGroup class="mt-lg">
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Components/ServiceForm/TenorServiceForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const save = () => {
<a href="https://console.cloud.google.com/" class="link" target="_blank">Create
an App on Google Console</a>.
</p>
<ReadDocHelp :href="`${$page.props.mixpost.docs_link}/books/services-configuration-mixpost/page/tenor`" class="mt-xs"/>
<ReadDocHelp :href="`${$page.props.mixpost.docs_link}/services/media/tenor`" class="mt-xs"/>
</template>

<HorizontalGroup class="mt-lg">
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Components/ServiceForm/TwitterServiceForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const save = () => {
<template #description>
<a href="https://developer.twitter.com/en/portal/projects-and-apps" class="link" target="_blank">Create
an App on Twitter</a>. You will need to edit the App Permissions and allow "Read and Write".
<ReadDocHelp :href="`${$page.props.mixpost.docs_link}/books/services-configuration-mixpost/page/twitter`" class="mt-xs"/>
<ReadDocHelp :href="`${$page.props.mixpost.docs_link}/services/social/x`" class="mt-xs"/>
</template>

<HorizontalGroup class="mt-lg">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const save = () => {
<a href="https://unsplash.com/oauth/applications" class="link" target="_blank">Create
an App on Unsplash</a>.
</p>
<ReadDocHelp :href="`${$page.props.mixpost.docs_link}/books/services-configuration-mixpost/page/unsplash`" class="mt-xs"/>
<ReadDocHelp :href="`${$page.props.mixpost.docs_link}/services/media//unsplash`" class="mt-xs"/>
</template>

<HorizontalGroup class="mt-lg">
Expand Down
4 changes: 2 additions & 2 deletions src/Builders/Filters/PostScheduledAt.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public static function apply(Builder $builder, $value): Builder
$date = Carbon::parse($value['date']);

if ($value['calendar_type'] === 'month') {
return $builder->whereYear('scheduled_at', $date->year)
->whereMonth('scheduled_at', $date->month);
return $builder->whereDate('scheduled_at', '>=', $date->clone()->startOfMonth()->subDays(10)->toDateString())
->whereDate('scheduled_at', '<=', $date->clone()->endOfMonth()->addDays(10)->toDateString());
}

if ($value['calendar_type'] === 'week') {
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/HandleInertiaRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function share(Request $request)
'name' => Config::get('app.name')
],
'mixpost' => [
'docs_link' => 'https://docs.inovector.com',
'docs_link' => 'https://docs.mixpost.app',
'version' => InstalledVersions::getVersion('inovector/mixpost'),
'mime_types' => Config::get('mixpost.mime_types'),
'settings' => [
Expand Down
4 changes: 2 additions & 2 deletions src/SocialProviders/Twitter/Concerns/ManagesResources.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected function storePostWithApiV2(string $text, array $mediaResult): SocialP
$postParameters['media']['media_ids'] = $mediaResult['ids'];
}

$postResult = $this->connection->post('tweets', $postParameters, true);
$postResult = $this->connection->post('tweets', $postParameters, ['jsonPayload' => true]);

return $this->buildResponse($postResult, function () use ($postResult) {
return [
Expand Down Expand Up @@ -105,7 +105,7 @@ public function uploadMedia(Collection $media): array
'media_type' => $item->mime_type,
'media_category' => $item->isImageGif() ? 'tweet_gif' : 'tweet_video',
'total_bytes' => $item->size,
], true);
], ['chunkedUpload' => true]);
}

if (!$result) {
Expand Down

0 comments on commit 4e21160

Please sign in to comment.